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); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a footnote reference marker (ref orc) /// </summary> /// <param name="footnote">given footnote</param> /// <param name="para">paragraph owning the translation to insert footnote marker into</param> /// <param name="ws">given writing system for the back translation</param> /// <param name="ichPos">The 0-based character offset into the translation</param> /// ------------------------------------------------------------------------------------ protected void InsertTestBtFootnote(StFootnote footnote, StTxtPara para, int ws, int ichPos) { ICmTranslation trans = para.GetOrCreateBT(); ITsStrBldr bldr = trans.Translation.GetAlternative(ws).UnderlyingTsString.GetBldr(); footnote.InsertRefORCIntoTrans(bldr, ichPos, ws); trans.Translation.SetAlternative(bldr.GetString(), ws); }