///<summary> /// Check items matching those in the given list. ///</summary> ///<param name="matchList">The list of items to check.</param> public void CheckSelectedItems(ArrayList matchList) { foreach (object item in CheckedItems) { FormsAssert.IsTrue(matchList.Contains(item)); } }
internal void Focus() { Control c = tester.TheObject as Control; FormsAssert.IsTrue(c != null, "Keyboard control requires tester of Control"); c.FindForm().Activate(); c.Focus(); }
/// <summary> /// Click a pushbutton /// </summary> public void Click() { FormsAssert.IsTrue((button.Style == ToolBarButtonStyle.PushButton) || (button.Style == ToolBarButtonStyle.ToggleButton || button.Style == ToolBarButtonStyle.DropDownButton)); ToolBarButtonClickEventArgs buttonArg = new ToolBarButtonClickEventArgs(Button); bar.FireEvent("ButtonClick", buttonArg); }
/// <summary> /// Click an item in a dropdown menu /// </summary> /// <param name="menuText">The name of the menu item to click</param> public void ClickDropDownMenuItem(string menuText) { FormsAssert.IsTrue(button.Style == ToolBarButtonStyle.DropDownButton); foreach (MenuItem item in button.DropDownMenu.MenuItems) { if (item.Text == menuText) { item.PerformClick(); return; } } }
/// <summary> /// Clicks the DropDownItem with the given index. /// </summary> /// <param name="index"></param> public void ClickDropDownItem(int index) { bool found = false; ToolStripSplitButton button = Properties; if (button.HasDropDownItems) { ToolStripItemCollection items = button.DropDownItems; if (items.Count > index) { ToolStripItem item = items[index]; FireEvent("DropDownItemClicked", new ToolStripItemClickedEventArgs(item)); found = true; } } FormsAssert.IsTrue(found, "No drop down item found at that index."); }
/// <summary> /// Initializes the KeyboardController, blocks user input, and sets /// the focus on the specified control. /// </summary> /// <param name="control">The ControlTester to use the keyboard on.</param> public void UseOn(ReflectionTester control) { if (control == null) { throw new ArgumentNullException("control"); } Control c = control.TheObject as Control; FormsAssert.IsTrue(c != null, "Keyboard control requires tester of Control"); sendKeys = sendKeysFactory.Create(c.Handle); keyboardControl = new KeyboardControl(control); if (!restoreUserInput) { //if this next line returns false, I used to throw an exception... Win32.BlockInput(true); restoreUserInput = true; } }
public void PartialPush() { FormsAssert.IsTrue(button.Style == ToolBarButtonStyle.ToggleButton); PartialPushed = !PartialPushed; }