Ejemplo n.º 1
0
        public void FindNext_WhenChangingIPManually()
        {
            CheckDisposed();

            m_testTeApp.ShowFindReplaceDialog(false, m_firstDraftView);
            FwFindReplaceDlg dlg = m_testTeApp.FindReplaceDialog;

            dlg.FindText = MakeTSS("the");

            // make sure the initial find works
            dlg.FindNext();
            Assert.AreEqual(0, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(2, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(1, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(138, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(142, m_firstDraftView.SelectionEndIndex);

            // make sure find next works
            dlg.FindNext();
            Assert.AreEqual(0, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(3, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(42, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(46, m_firstDraftView.SelectionEndIndex);

            // make sure find next works finding in a book title
            dlg.FindNext();
            Assert.AreEqual(1, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(0, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(3, m_firstDraftView.SelectionEndIndex);

            // make sure find next works after setting the IP manually
            m_firstDraftView.SetInsertionPoint(2, 4, 1, 163, true);
            dlg.FindNext();
            Assert.AreEqual(2, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(4, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(1, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(174, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(177, m_firstDraftView.SelectionEndIndex);
        }
Ejemplo n.º 2
0
        public void FindNext_NoMatchesFound()
        {
            CheckDisposed();

            m_testTeApp.ShowFindReplaceDialog(false, m_firstDraftView);
            FwFindReplaceDlg dlg = m_testTeApp.FindReplaceDialog;

            dlg.MatchNotFound += new FwFindReplaceDlg.MatchNotFoundHandler(FindDlgMatchNotFound);
            dlg.FindText       = MakeTSS("The will of the people");

            // make sure the initial find works
            m_noMatchFoundType = FwFindReplaceDlg.MatchType.NotSet;
            dlg.FindNext();
            Assert.AreEqual(FwFindReplaceDlg.MatchType.NoMatchFound,
                            m_noMatchFoundType);
        }