Пример #1
0
        public void FindNext_DifferentSearches()
        {
            CheckDisposed();

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

            dlg.MatchNotFound += new FwFindReplaceDlg.MatchNotFoundHandler(FindDlgMatchNotFound);
            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);

            dlg.FindText = MakeTSS("jude");

            // make sure the search finds the first occurance (in the view) of Jude.
            dlg.FindNext();
            Assert.AreEqual(2, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(16, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(20, m_firstDraftView.SelectionEndIndex);
        }
Пример #2
0
        public void FindNext_AfterFailedFind()
        {
            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);

            dlg.FindText = MakeTSS("jude");

            // make sure the search finds the first occurance (in the view) of Jude.
            dlg.FindNext();
            Assert.AreEqual(2, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(16, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(20, m_firstDraftView.SelectionEndIndex);
        }
Пример #3
0
        public void FindNext_Wrap()
        {
            CheckDisposed();

            // Set IP to a point between the second and third occurances of the word 'Jude'.
            m_firstDraftView.SetInsertionPoint(2, 1, 0, 1, true);

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

            dlg.FindText = MakeTSS("jude");

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

            // make sure the search wraps and finds the first occurance (in the view) of Jude.
            dlg.FindNext();
            Assert.AreEqual(2, m_firstDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_firstDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_firstDraftView.ParagraphIndex);
            Assert.AreEqual(16, m_firstDraftView.SelectionAnchorIndex);
            Assert.AreEqual(20, m_firstDraftView.SelectionEndIndex);
        }
Пример #4
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);
        }
Пример #5
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);
        }