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); }
public void TestItemCount() { FormsListBox listbox1 = new FormsListBox(testDlg["listBox1"]()); int itemCount = listbox1.ItemCount; Assert.AreEqual(7, itemCount); }
public void TestFindListIndex() { FormsListBox listbox1 = new FormsListBox(testDlg["listBox1"]()); int findIndex = listbox1.FindListIndex("Item-4"); listbox1.EmulateChangeSelectedIndex(findIndex); Assert.AreEqual(3, listbox1.SelectedIndex); }
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); }
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); }
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))});"); } }
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); }
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]); }