public void GetBookHvoWithFootnotes()
        {
            IScripture scr     = Cache.LangProject.TranslatedScriptureOA;
            IScrBook   genesis = scr.ScriptureBooksOS[0];
            // Add a footnote in the first book, first section, first paragraph
            IScrSection section  = genesis.SectionsOS[0];
            IStFootnote footnote = AddFootnote(genesis,
                                               (IStTxtPara)section.ContentOA.ParagraphsOS[0], 2, "A footnote");

            m_ScrPubCtrl.CallRefreshDisplay();
            m_ScrPubCtrl.CreatePages();
            m_ScrPubCtrl.PrepareToDrawPages(0, m_ScrPubCtrl.AutoScrollMinSize.Height * 2);

            // Simulate setting the IP at the beginning of the footnote
            bool fFoundPageWithFootnotes = false;

            foreach (DummyPage page in m_ScrPubCtrl.Pages)
            {
                if (page.DependentObjectsRootStream != null)
                {
                    fFoundPageWithFootnotes = true;
                    ((IVwRootBox)page.DependentObjectsRootStream).MakeSimpleSel(true, true, false, true);
                    m_ScrPubCtrl.FocusedStream = page.DependentObjectsRootStream;
                    break;
                }
            }
            Assert.IsTrue(fFoundPageWithFootnotes, "Can't run this test without finding any footnotes");

            SelectionHelper selHelper = SelectionHelper.Create(m_ScrPubCtrl);
            IScrBook        book      = m_ScrPubCtrl.GetBook(selHelper, SelectionHelper.SelLimitType.Anchor);

            Assert.AreEqual(genesis, book);
        }
示例#2
0
        public void GetBookHvoWithFootnotes()
        {
            IScripture scr     = Cache.LangProject.TranslatedScriptureOA;
            ScrBook    genesis = (ScrBook)scr.ScriptureBooksOS[0];
            // Add a footnote in the first book, first section, first paragraph
            IScrSection section  = (IScrSection)genesis.SectionsOS[0];
            StFootnote  footnote = m_scrInMemoryCache.AddFootnote(genesis,
                                                                  (StTxtPara)section.ContentOA.ParagraphsOS[0], 2);
            StTxtPara para = m_scrInMemoryCache.AddParaToMockedText(footnote.Hvo,
                                                                    ScrStyleNames.NormalFootnoteParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para, "A footnote", 0);

            m_ScrPubCtrl.CreatePages();
            m_ScrPubCtrl.PrepareToDrawPages(0, m_ScrPubCtrl.AutoScrollMinSize.Height * 2);

            // Simulate setting the IP at the beginning of the footnote
            bool fFoundPageWithFootnotes = false;

            foreach (DummyPage page in m_ScrPubCtrl.Pages)
            {
                if (page.DependentObjectsRootStream != null)
                {
                    fFoundPageWithFootnotes = true;
                    ((IVwRootBox)page.DependentObjectsRootStream).MakeSimpleSel(true, true, false, true);
                    m_ScrPubCtrl.FocusedStream = page.DependentObjectsRootStream;
                    break;
                }
            }
            Assert.IsTrue(fFoundPageWithFootnotes, "Can't run this test without finding any footnotes");

            SelectionHelper selHelper = SelectionHelper.Create(m_ScrPubCtrl);
            int             hvoBook   = m_ScrPubCtrl.GetBookHvo(selHelper, SelectionHelper.SelLimitType.Anchor);

            Assert.AreEqual(genesis.Hvo, hvoBook);
        }