Esempio n. 1
0
        public void InsertVerseNumber_MidPara()
        {
            // set the IP in middle of Phm 1:8
            m_draftView.SetInsertionPoint(0, 3, 2, 8, true);

            // insert verse num at the IP
            m_draftView.InsertVerseNumber();

            //verify verse num 9 was properly inserted
            IScrBook book =
                Cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS[0];
            IStTxtPara para =
                (IStTxtPara)book.SectionsOS[3].ContentOA.ParagraphsOS[2];
            ITsString tss = para.Contents;

            Assert.AreEqual(20, tss.RunCount);
            AssertEx.RunIsCorrect(tss, 1, "Aussi, ", null, Cache.DefaultVernWs);
            AssertEx.RunIsCorrect(tss, 2, "9", "Verse Number", Cache.DefaultVernWs);
            Assert.AreEqual("bien que",
                            para.Contents.get_RunText(3).Substring(0, 8));
            Assert.AreEqual(StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs),
                            para.Contents.get_Properties(3));
        }
        public void ApplyStyle_CharStyleNotAppliedToBorderingWhiteSpace()
        {
            CheckDisposed();
            m_draftView.RefreshDisplay();

            // Select a word in the book intro with white space around it: " text. "
            m_draftView.SetInsertionPoint(0, 0, 0, 5, false);
            IVwSelection sel0 = m_draftView.RootBox.Selection;

            Assert.IsNotNull(sel0);
            m_draftView.SetInsertionPoint(0, 0, 0, 12, true);
            IVwSelection sel1 = m_draftView.RootBox.Selection;

            Assert.IsNotNull(sel1);
            IVwSelection rangeSel = m_draftView.RootBox.MakeRangeSelection(sel0, sel1, true);
            ITsString    tssSelected;

            rangeSel.GetSelectionString(out tssSelected, "*");
            Assert.AreEqual(" text. ", tssSelected.Text);

            // Apply a character style to the selected text.
            m_draftView.ApplyStyle("Emphasis");

            // The selection should be updated to omit bordering white space in the original selection.
            m_draftView.RootBox.Selection.GetSelectionString(out tssSelected, "*");
            Assert.AreEqual("text.", tssSelected.Text);

            // Confirm that the character styles are applied correctly: Emphasis style applied only to "text."
            ScrSection introSection = (ScrSection)m_exodus.SectionsOS[0];
            ITsString  paraContents = ((StTxtPara)introSection.ContentOA.ParagraphsOS[0]).Contents.UnderlyingTsString;

            Assert.AreEqual(3, paraContents.RunCount);
            Assert.AreEqual(7, paraContents.get_MinOfRun(1));
            Assert.AreEqual(11, paraContents.get_LimOfRun(1));
            ITsTextProps ttp = paraContents.get_Properties(0);

            Assert.IsNull(ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle),
                          "First run should be 'Default Paragraph Characters'");
            ttp = paraContents.get_Properties(1);
            Assert.AreEqual("Emphasis", ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle));
            ttp = paraContents.get_Properties(2);
            Assert.IsNull(ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle),
                          "Third run should be 'Default Paragraph Characters'");
        }
Esempio n. 3
0
        public void FindPrevBackTrans_BeginningOfTitle()
        {
            CheckDisposed();

            m_btDraftView.SetInsertionPoint((int)ScrBook.ScrBookTags.kflidTitle, 0, 0);

            m_btDraftView.CallPrevUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.IsTrue(m_btDraftView.TeEditingHelper.InBookTitle);
        }