예제 #1
0
        public void UserPromptForSectionHeadWithEmptyPara()
        {
            CheckDisposed();

            // Set up section head with an empty paragraph
            IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
            StTxtPara   para    = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "",
                                                                              ScrStyleNames.SectionHead);

            section.AdjustReferences();
            Options.ShowEmptyParagraphPromptsSetting = true;

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

            CreateExpectedUserPrompt(stVc, para.Hvo,
                                     (int)ScrSection.ScrSectionTags.kflidHeading, (int)StTxtPara.StTxtParaTags.kflidContents);

            IVwEnv vwEnv      = (IVwEnv)m_vwenvMock.MockInstance;
            bool   fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
                                                 (int)ScrSection.ScrSectionTags.kflidHeading);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type section head here", m_inMemoryCache.Cache.DefaultVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.Verify();
        }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Append a new section to the given book, having the specified text as the section
        /// head.
        /// </summary>
        /// <param name="book">The book to which the section is to be appended</param>
        /// <param name="sSectionHead">The text of the new section head</param>
        /// <param name="startRef">The BBCCCVVV reference for the start/min</param>
        /// <param name="endRef">The BBCCCVVV reference for the end/max</param>
        /// <returns>The newly created section</returns>
        /// ------------------------------------------------------------------------------------
        protected IScrSection CreateSection(IScrBook book, string sSectionHead, int startRef, int endRef)
        {
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, sSectionHead,
                                                           ScrStyleNames.SectionHead);
            //note: the InMemoryCache has created the StTexts owned by this section
            section.VerseRefMin = section.VerseRefStart = startRef;
            section.VerseRefMax = section.VerseRefEnd = endRef;
            return(section);
        }