public void DeleteFootnoteMarkerInBt_ContextMenu() { IScrBook book = AddBookToMockedScripture(1, "Genesis"); AddTitleToMockedBook(book, "Genesis"); m_draftView.BookFilter.Add(book); IScrSection section = AddSectionToMockedBook(book); AddSectionHeadParaToSection(section, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph IStTxtPara parentPara = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddRunToMockedPara(parentPara, "1", ScrStyleNames.ChapterNumber); AddRunToMockedPara(parentPara, "1", ScrStyleNames.VerseNumber); AddRunToMockedPara(parentPara, "uno ", null); AddRunToMockedPara(parentPara, "2", ScrStyleNames.VerseNumber); AddRunToMockedPara(parentPara, "dos ", null); IStFootnote footnote1 = AddFootnote(book, parentPara, 5); AddParaToMockedText(footnote1, ScrStyleNames.NormalFootnoteParagraph); IStFootnote footnote2 = AddFootnote(book, parentPara, 10); AddParaToMockedText(footnote2, ScrStyleNames.NormalFootnoteParagraph); Assert.AreEqual(2, book.FootnotesOS.Count); // Construct the initial back translation int wsBt = Cache.DefaultAnalWs; ICmTranslation trans = AddBtToMockedParagraph(parentPara, wsBt); AddRunToMockedTrans(trans, wsBt, "one two", null); ITsStrBldr btTssBldr = trans.Translation.get_String(wsBt).GetBldr(); TsStringUtils.InsertOrcIntoPara(footnote1.Guid, FwObjDataTypes.kodtNameGuidHot, btTssBldr, 3, 3, wsBt); TsStringUtils.InsertOrcIntoPara(footnote2.Guid, FwObjDataTypes.kodtNameGuidHot, btTssBldr, 8, 8, wsBt); trans.Translation.set_String(wsBt, btTssBldr.GetString()); m_draftView.RefreshDisplay(); // Delete the marker for the back translation of the first footnote. We have to make a range selection // because by the time the tested method is called, a range selection of any adjacent footnotes has // already been made. SelectionHelper selHelper = m_draftView.SelectRangeOfChars(0, 0, 0, 3, 4); m_draftView.CallDeleteFootnote(); // Verify that both original footnotes still exist and that the first BT footnote marker is // deleted. Assert.AreEqual(2, book.FootnotesOS.Count); VerifyFootnote(footnote1, parentPara, 5); VerifyFootnote(footnote2, parentPara, 10); Assert.AreEqual("one two" + StringUtils.kChObject, trans.Translation.get_String(wsBt).Text); FdoTestHelper.VerifyBtFootnote(footnote2, parentPara, wsBt, 7); }
public void InsertFootnote_InBt() { IScrBook book = AddBookToMockedScripture(1, "Genesis"); AddTitleToMockedBook(book, "Genesis"); m_draftView.BookFilter.Add(book); IScrSection section = AddSectionToMockedBook(book); AddSectionHeadParaToSection(section, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph in the vernacular. IScrTxtPara parentPara = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddVerse(parentPara, 1, 1, "uno"); AddVerse(parentPara, 0, 2, "dos"); IScrFootnote footnote1 = AddFootnote(book, parentPara, 5); AddParaToMockedText(footnote1, ScrStyleNames.NormalFootnoteParagraph); IScrFootnote footnote2 = AddFootnote(book, parentPara, 10); AddParaToMockedText(footnote2, ScrStyleNames.NormalFootnoteParagraph); Assert.AreEqual(2, book.FootnotesOS.Count); // Construct the initial back translation int wsBt = Cache.DefaultAnalWs; ICmTranslation trans = AddBtToMockedParagraph(parentPara, wsBt); AddRunToMockedTrans(trans, wsBt, "one two", null); ITsStrBldr btTssBldr = trans.Translation.get_String(wsBt).GetBldr(); trans.Translation.set_String(wsBt, btTssBldr.GetString()); m_draftView.RefreshDisplay(); m_draftView.SetInsertionPoint(0, 0, 0, 3, false); //set the IP after the word "one" int iBtFootnote1; m_draftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote1); VerifyRequestedBTSelection(0, 0, ScrSectionTags.kflidContent, 0, 4); m_draftView.RefreshDisplay(); m_draftView.SetInsertionPoint(0, 0, 0, 8, false); // set the IP after the word "two" int iBtFootnote2; m_draftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote2); VerifyRequestedBTSelection(0, 0, ScrSectionTags.kflidContent, 0, 9); // Confirm that the footnote callers were inserted in the correct locations. Assert.AreEqual("one" + StringUtils.kChObject + " two" + StringUtils.kChObject, trans.Translation.get_String(wsBt).Text); FdoTestHelper.VerifyBtFootnote(footnote1, parentPara, wsBt, 3); FdoTestHelper.VerifyBtFootnote(footnote2, parentPara, wsBt, 8); }
public void InsertFootnote_AtEndBtWithLongCallers() { m_scr.FootnoteMarkerSymbol = "@#$"; m_scr.FootnoteMarkerType = FootnoteMarkerTypes.SymbolicFootnoteMarker; IScrBook book = AddBookToMockedScripture(1, "Genesis"); AddTitleToMockedBook(book, "Genesis"); m_draftView.BookFilter.Add(book); IScrSection section = AddSectionToMockedBook(book); AddSectionHeadParaToSection(section, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph in the vernacular. IScrTxtPara parentPara = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddVerse(parentPara, 1, 1, "uno"); AddVerse(parentPara, 0, 2, "dos"); IScrFootnote footnote1 = AddFootnote(book, parentPara, parentPara.Contents.Length); AddParaToMockedText(footnote1, ScrStyleNames.NormalFootnoteParagraph); Assert.AreEqual(1, book.FootnotesOS.Count); // Construct the initial back translation int wsBt = Cache.DefaultAnalWs; ICmTranslation trans = AddBtToMockedParagraph(parentPara, wsBt); AddRunToMockedTrans(trans, wsBt, "a", null); ITsStrBldr btTssBldr = trans.Translation.get_String(wsBt).GetBldr(); TsStringUtils.InsertOrcIntoPara(footnote1.Guid, FwObjDataTypes.kodtNameGuidHot, btTssBldr, btTssBldr.Length, btTssBldr.Length, wsBt); trans.Translation.set_String(wsBt, btTssBldr.GetString()); m_draftView.RefreshDisplay(); m_draftView.SetInsertionPoint(0, 0, 0, btTssBldr.Length, false); //set the IP after the footnote int iBtFootnote2; m_draftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote2); m_draftView.RefreshDisplay(); // Confirm that the footnote callers were inserted in the correct locations. Assert.AreEqual("a" + StringUtils.kChObject, trans.Translation.get_String(wsBt).Text); FdoTestHelper.VerifyBtFootnote(footnote1, parentPara, wsBt, btTssBldr.Length - 1); }
public void InsertFootnote_WithRangeSelectionInBt() { IScrBook book = AddBookToMockedScripture(1, "Genesis"); AddTitleToMockedBook(book, "Genesis"); m_draftView.BookFilter.Add(book); IScrSection section = AddSectionToMockedBook(book); AddSectionHeadParaToSection(section, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph in the vernacular. IScrTxtPara parentPara = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddVerse(parentPara, 1, 1, "uno"); AddVerse(parentPara, 0, 2, "dos"); IScrFootnote footnote1 = AddFootnote(book, parentPara, 5); AddParaToMockedText(footnote1, ScrStyleNames.NormalFootnoteParagraph); IScrFootnote footnote2 = AddFootnote(book, parentPara, 10); AddParaToMockedText(footnote2, ScrStyleNames.NormalFootnoteParagraph); Assert.AreEqual(2, book.FootnotesOS.Count); // Construct the initial back translation int wsBt = Cache.DefaultAnalWs; ICmTranslation trans = AddBtToMockedParagraph(parentPara, wsBt); AddRunToMockedTrans(trans, wsBt, "one two", null); ITsStrBldr btTssBldr = trans.Translation.get_String(wsBt).GetBldr(); trans.Translation.set_String(wsBt, btTssBldr.GetString()); m_draftView.RefreshDisplay(); m_draftView.SelectRangeOfChars(0, 0, 0, 0, 3); // select the word "one" int iBtFootnote1; m_draftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote1); VerifyRequestedBTSelection(0, 0, ScrSectionTags.kflidContent, 0, 4); m_draftView.RefreshDisplay(); m_draftView.SelectRangeOfChars(0, 0, 0, 8, 5); // select the word "two" -- end before anchor int iBtFootnote2; m_draftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote2); VerifyRequestedBTSelection(0, 0, ScrSectionTags.kflidContent, 0, 9); // Confirm that the footnote callers were inserted in the correct locations. Assert.AreEqual("one" + StringUtils.kChObject + " two" + StringUtils.kChObject, trans.Translation.get_String(wsBt).Text); FdoTestHelper.VerifyBtFootnote(footnote1, parentPara, wsBt, 3); FdoTestHelper.VerifyBtFootnote(footnote2, parentPara, wsBt, 8); // Confirm that the footnote back translations contain the text that was selected // when they were inserted. ICmTranslation transFootnote1 = ((IScrTxtPara)footnote1.ParagraphsOS[0]).GetBT(); Assert.IsNotNull(transFootnote1); AssertEx.AreTsStringsEqual(DraftViewTests.GetReferencedTextFootnoteStr("one", Cache.DefaultAnalWs), transFootnote1.Translation.get_String(wsBt)); ICmTranslation transFootnote2 = ((IScrTxtPara)footnote2.ParagraphsOS[0]).GetBT(); Assert.IsNotNull(transFootnote2); AssertEx.AreTsStringsEqual(DraftViewTests.GetReferencedTextFootnoteStr("two", Cache.DefaultAnalWs), transFootnote2.Translation.get_String(wsBt)); }