示例#1
0
        public void TestFindExact()
        {
            FormsListBox listbox1  = new FormsListBox(testDlg["listBox1"]());
            int          findIndex = listbox1.FindStringExact("Item-11");

            Assert.AreEqual(6, findIndex);
            listbox1["Items"]()["Add"](@"dmy");
            listbox1["Items"]()["Add"](@"Item-11");
            findIndex = listbox1.FindStringExact(@"Item-11", 7);
            Assert.AreEqual(listbox1.ItemCount - 1, findIndex);
            listbox1["Items"]()["RemoveAt"](listbox1.ItemCount - 1);
            listbox1["Items"]()["RemoveAt"](listbox1.ItemCount - 1);
        }
 public MainFormDriver(WindowControl window)
 {
     Window = window;
     ListBoxEmployee = new FormsListBox(window.Dynamic()._listBoxEmployee);
     ButtonAdd = new FormsButton(window.Dynamic()._buttonAdd);
     ButtonSearch = new FormsButton(window.Dynamic()._buttonSearch);
 }
示例#3
0
        public void TestItemCount()
        {
            FormsListBox listbox1  = new FormsListBox(testDlg["listBox1"]());
            int          itemCount = listbox1.ItemCount;

            Assert.AreEqual(7, itemCount);
        }
示例#4
0
 public MainFormDriver(WindowControl window)
 {
     Window          = window;
     ListBoxEmployee = new FormsListBox(window.Dynamic()._listBoxEmployee);
     ButtonAdd       = new FormsButton(window.Dynamic()._buttonAdd);
     ButtonSearch    = new FormsButton(window.Dynamic()._buttonSearch);
 }
示例#5
0
        public void TestFindListIndex()
        {
            FormsListBox listbox1  = new FormsListBox(testDlg["listBox1"]());
            int          findIndex = listbox1.FindListIndex("Item-4");

            listbox1.EmulateChangeSelectedIndex(findIndex);
            Assert.AreEqual(3, listbox1.SelectedIndex);
        }
示例#6
0
        public void TestSelectionMode()
        {
            FormsListBox listbox1 = new FormsListBox(testDlg["listBox1"]());
            FormsListBox listbox2 = new FormsListBox(testDlg["listBox2"]());

            Assert.AreEqual(SelectionMode.One, listbox1.SelectionMode);
            Assert.AreEqual(SelectionMode.MultiSimple, listbox2.SelectionMode);
        }
示例#7
0
 public SearchFormDriver(WindowControl window, Async async)
 {
     Async           = async;
     Window          = window;
     ButtonExecute   = new FormsButton(Window.Dynamic()._buttonExecute);
     TextBoxSearch   = new FormsTextBox(Window.Dynamic()._textBoxSearch);
     ListBoxEmployee = new FormsListBox(Window.Dynamic()._listBoxEmployee);
 }
 public SearchFormDriver(WindowControl window, Async async)
 {
     Async = async;
     Window = window;
     ButtonExecute = new FormsButton(Window.Dynamic()._buttonExecute);
     TextBoxSearch = new FormsTextBox(Window.Dynamic()._textBoxSearch);
     ListBoxEmployee = new FormsListBox(Window.Dynamic()._listBoxEmployee);
 }
示例#9
0
        static void Assert(string accessPath, FormsListBox listBox)
        {
            var texts = listBox.GetAllItemText();

            for (int i = 0; i < texts.Length; i++)
            {
                CaptureAdaptor.AddCode($"{accessPath}.GetItemText({i}).Is({ToLiteral(listBox.GetItemText(i))});");
            }
        }
示例#10
0
        public void TestSelectIndexes()
        {
            FormsListBox listbox2 = new FormsListBox(testDlg["listBox2"]());

            int[] select = new int[] { 5 };
            listbox2.EmulateChangeSelectedIndex(5, new Async());
            int selected = listbox2.SelectedIndex;

            Assert.AreEqual(5, selected);
        }
示例#11
0
        public void TestEmulateChangeSelectedState()
        {
            FormsListBox listbox2 = new FormsListBox(testDlg["listBox2"]());

            listbox2.EmulateChangeSelectedState(4, true);
            int[] selected1 = listbox2.SelectedIndexes;
            Assert.AreEqual(1, selected1.Length);
            Assert.AreEqual(4, selected1[0]);

            // 非同期
            app[GetType(), "ChangeSelectedIndexEvent"](listbox2.AppVar);
            listbox2.EmulateChangeSelectedState(2, true, new Async());
            new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK");
            Assert.AreEqual(1, selected1.Length);
            int[] selected2 = listbox2.SelectedIndexes;
            Assert.AreEqual(2, selected2[0]);
        }