public void DeleteFootnoteMarkerInBt_ContextMenu() { CheckDisposed(); IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus"); m_scrInMemoryCache.AddTitleToMockedBook(book.Hvo, "Exodus"); m_btDraftView.BookFilter.Insert(0, book.Hvo); IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo); m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph StTxtPara parentPara = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, ScrStyleNames.NormalParagraph); m_scrInMemoryCache.AddRunToMockedPara(parentPara, "1", ScrStyleNames.ChapterNumber); m_scrInMemoryCache.AddRunToMockedPara(parentPara, "1", ScrStyleNames.VerseNumber); m_scrInMemoryCache.AddRunToMockedPara(parentPara, "uno ", null); m_scrInMemoryCache.AddRunToMockedPara(parentPara, "2", ScrStyleNames.VerseNumber); m_scrInMemoryCache.AddRunToMockedPara(parentPara, "dos ", null); StFootnote footnote1 = m_scrInMemoryCache.AddFootnote(book, parentPara, 5); m_scrInMemoryCache.AddParaToMockedText(footnote1.Hvo, ScrStyleNames.NormalFootnoteParagraph); StFootnote footnote2 = m_scrInMemoryCache.AddFootnote(book, parentPara, 10); m_scrInMemoryCache.AddParaToMockedText(footnote2.Hvo, ScrStyleNames.NormalFootnoteParagraph); Guid guid1 = footnote1.Guid; Guid guid2 = footnote2.Guid; Assert.AreEqual(2, book.FootnotesOS.Count); section.AdjustReferences(); // Construct the initial back translation int wsBt = m_inMemoryCache.Cache.DefaultAnalWs; ICmTranslation trans = m_inMemoryCache.AddBtToMockedParagraph(parentPara, wsBt); m_inMemoryCache.AddRunToMockedTrans(trans, wsBt, "one two", null); ITsStrBldr btTssBldr = trans.Translation.GetAlternative(wsBt).UnderlyingTsString.GetBldr(); footnote1.InsertRefORCIntoTrans(btTssBldr, 3, wsBt); footnote2.InsertRefORCIntoTrans(btTssBldr, 8, wsBt); trans.Translation.SetAlternative(btTssBldr.GetString(), wsBt); SelectionHelper selHelper = m_btDraftView.SetInsertionPoint(0, 0, 0, 3, false); //set the IP // Delete the marker for the back translation of the first footnote m_btDraftView.OnDeleteFootnote(); // 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.GetAlternative(wsBt).UnderlyingTsString.Text); StTxtParaTests.VerifyBtFootnote(footnote2, parentPara, wsBt, 7); }
public void InsertFootnote_InBt() { CheckDisposed(); IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus"); m_scrInMemoryCache.AddTitleToMockedBook(book.Hvo, "Exodus"); m_btDraftView.BookFilter.Insert(0, book.Hvo); IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo); m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "The first section", ScrStyleNames.SectionHead); // Construct a parent paragraph in the vernacular. StTxtPara parentPara = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, ScrStyleNames.NormalParagraph); AddVerse(parentPara, 1, 1, "uno"); AddVerse(parentPara, 0, 2, "dos"); StFootnote footnote1 = m_scrInMemoryCache.AddFootnote(book, parentPara, 5); m_scrInMemoryCache.AddParaToMockedText(footnote1.Hvo, ScrStyleNames.NormalFootnoteParagraph); StFootnote footnote2 = m_scrInMemoryCache.AddFootnote(book, parentPara, 10); m_scrInMemoryCache.AddParaToMockedText(footnote2.Hvo, ScrStyleNames.NormalFootnoteParagraph); Assert.AreEqual(2, book.FootnotesOS.Count); section.AdjustReferences(); // Construct the initial back translation int wsBt = m_inMemoryCache.Cache.DefaultAnalWs; ICmTranslation trans = m_inMemoryCache.AddBtToMockedParagraph(parentPara, wsBt); m_inMemoryCache.AddRunToMockedTrans(trans, wsBt, "one two", null); ITsStrBldr btTssBldr = trans.Translation.GetAlternative(wsBt).UnderlyingTsString.GetBldr(); trans.Translation.SetAlternative(btTssBldr.GetString(), wsBt); m_btDraftView.SetInsertionPoint(0, 0, 0, 3, false); //set the IP after the word "one" int iBtFootnote1; m_btDraftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote1); m_btDraftView.SetInsertionPoint(0, 0, 0, 8, false); // set the IP after the word "two" int iBtFootnote2; m_btDraftView.TeEditingHelper.InsertFootnote(ScrStyleNames.NormalFootnoteParagraph, out iBtFootnote2); // Confirm that the footnote callers were inserted in the correct locations. Assert.AreEqual("one" + StringUtils.kchObject + " two" + StringUtils.kchObject, trans.Translation.GetAlternative(wsBt).UnderlyingTsString.Text); StTxtParaTests.VerifyBtFootnote(footnote1, parentPara, wsBt, 3); StTxtParaTests.VerifyBtFootnote(footnote2, parentPara, wsBt, 8); }