Ejemplo n.º 1
0
        public void StartsWithTest()
        {
            SetSearchString("cvc");
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(0, 1));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 1));
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(3, 1));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(4, 1));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(5, 1));

            // Looping back to the top so use FindFirst()
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(0, 1));

            m_findDlg.StartsWith = true;

            ResetStartCell();
            SetSearchString("cvc");
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(0, 1));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 1));
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(3, 1));

            // Looping back to the top so use FindFirst()
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(0, 1));
        }
Ejemplo n.º 2
0
        public void FindPrevPrevTest()
        {
            SetSearchString("drillbit");

            Assert.AreEqual(true, FindInfo.FindFirst(true));
            Assert.AreEqual(true, IsCurrCellLocation(4, 2));

            Assert.AreEqual(true, FindInfo.Find(true));
            Assert.AreEqual(true, IsCurrCellLocation(4, 0));
        }
Ejemplo n.º 3
0
        public void FindBackBackForTest()
        {
            SetSearchString("glebay");

            Assert.AreEqual(true, FindInfo.FindFirst(true));
            Assert.AreEqual(true, IsCurrCellLocation(2, 2));             // glebay
            Assert.AreEqual(true, FindInfo.Find(true));
            Assert.AreEqual(true, IsCurrCellLocation(2, 2));             // glebay
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(2, 2));             // glebay
        }
Ejemplo n.º 4
0
        public void FindForLastColBackTest()
        {
            SetSearchString("glbitter");

            Assert.IsTrue(FindInfo.FindFirst(false), "Did not find first forward");  // Forward find
            Assert.IsTrue(IsCurrCellLocation(1, 2), "Curr. Cell Location is not 1,3");
            Assert.IsTrue(FindInfo.Find(false), "Did not find next forward");        // Forward find
            Assert.IsTrue(IsCurrCellLocation(3, 2), "Curr. Cell Location is not 3,3");
            Assert.IsTrue(FindInfo.Find(true), "Did not find backward");             // Backward find
            Assert.IsTrue(IsCurrCellLocation(1, 2), "Curr. Cell Location is not 1,3");
        }
Ejemplo n.º 5
0
        public void FindBackFirstColForTest()
        {
            m_findDlg.StartsWith = true;
            SetSearchString("bit");

            Assert.AreEqual(true, FindInfo.FindFirst(true));
            Assert.AreEqual(true, IsCurrCellLocation(3, 0));            // bitter
            Assert.AreEqual(true, FindInfo.Find(true));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));            // bit
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(3, 0));            // bitter
        }
Ejemplo n.º 6
0
        public void MatchCaseTest()
        {
            SetSearchString("glfib");
            m_findDlg.MatchCase = false;
            Assert.IsTrue(FindInfo.Find(false));
            Assert.IsTrue(IsCurrCellLocation(0, 2));

            m_findDlg.MatchCase = true;

            SetSearchString("glfib");
            Assert.IsFalse(FindInfo.FindFirst(false));

            SetSearchString("GLFIB");
            Assert.IsTrue(FindInfo.Find(false));
            Assert.IsTrue(IsCurrCellLocation(0, 2));
        }
Ejemplo n.º 7
0
        public void MatchEntireWordTest()
        {
            SetSearchString("bit");
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(3, 0));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(3, 2));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(4, 0));                    // drillbit
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(4, 2));                    // drillbit
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(5, 2));                    // glabitging

            // Looping back to the top so use FindFirst()
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));

            ResetStartCell();

            m_findDlg.MatchEntireWord = true;
            SetSearchString("bit");
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));

            Assert.AreEqual(true, FindInfo.FindFirst(true));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));
            Assert.AreEqual(true, FindInfo.Find(true));
            Assert.AreEqual(true, IsCurrCellLocation(1, 0));
        }
Ejemplo n.º 8
0
        public void GroupOnSortedFieldTest()
        {
            // Test data before grouping
            SetSearchString("cvc");
            m_findDlg.MatchEntireWord = true;
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(0, 1));             // cvc
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 1));             // cvc

            m_grid.Sort("Gloss", false);

            // Adds 5 new SilHierarchicalGridRow's & 1 new column
            m_grid.GroupByField = _prj.Fields.Single(f => f.Name == "Gloss");

            ResetStartCell();
            // WordListGroupingBuilder>GroupByField() inserted a hierarchical column for
            // the + and - glpyhs, so we also have to update the column indexes by
            // passing 'true' to ResetStartSearchCell().
            FindInfo.ResetStartSearchCell(true);

            SetSearchString("cvc");
            m_findDlg.MatchEntireWord = true;
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2));             // cvc
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(6, 2));             // cvc
            Assert.AreEqual(true, FindInfo.Find(false));

            // ------------------------------------------------------------------------------------
            // Testing finds in collapsed & expanded groups.
            // ------------------------------------------------------------------------------------

            m_grid.ToggleGroupExpansion(false);             // collapse all groups
            FindInfo.SearchCollapsedGroups = false;

            ResetStartCell();
            Assert.AreEqual(false, FindInfo.FindFirst(false));
            Assert.AreEqual(false, FindInfo.Find(false));
            Assert.AreEqual(false, FindInfo.Find(false));

            m_grid.ToggleGroupExpansion(true);               // expand all groups
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2)); // cvc
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(6, 2)); // cvc
            Assert.AreEqual(true, FindInfo.Find(false));

            // ------------------------------------------------------------------------------------
            // Searching for "cvc" in 2 groups after collapsing one of them.
            // ------------------------------------------------------------------------------------

            // Collapse 'glbitter' Group
            ((SilHierarchicalGridRow)m_grid.Rows[4]).SetExpandedState(false, false);

            ResetStartCell();
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2));

            // ------------------------------------------------------------------------------------
            // Searching for "cvc" in 2 groups after collapsing one of them, but
            // searching collapsed groups this time.
            // ------------------------------------------------------------------------------------
            FindInfo.SearchCollapsedGroups = true;

            ResetStartCell();
            Assert.AreEqual(true, FindInfo.FindFirst(false));
            Assert.AreEqual(true, IsCurrCellLocation(1, 2));
            Assert.AreEqual(true, FindInfo.Find(false));
            Assert.AreEqual(true, IsCurrCellLocation(6, 2));
        }