Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="selectedItems"></param>
 public void CheckSelectedItems(ArrayList matchList)
 {
     foreach (object item in CheckedItems)
     {
         FormsAssert.IsTrue(matchList.Contains(item));
     }
 }
Example #2
0
        /// <summary>
        /// Click a pushbutton
        /// </summary>
        public void Click()
        {
            FormsAssert.IsTrue((button.Style == ToolBarButtonStyle.PushButton) ||
                               (button.Style == ToolBarButtonStyle.ToggleButton));
            ToolBarButtonClickEventArgs buttonArg = new ToolBarButtonClickEventArgs(Button);

            bar.FireEvent("ButtonClick", buttonArg);
        }
Example #3
0
        internal void Focus()
        {
            Control c = tester.TheObject as Control;

            FormsAssert.IsTrue(c != null, "Keyboard control requires tester of Control");
            c.FindForm().Activate();
            c.Focus();
        }
Example #4
0
 /// <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;
         }
     }
 }
Example #5
0
        /// <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.");
        }
Example #6
0
        /// <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...
                User32.BlockInput(true);
                restoreUserInput = true;
            }
        }
Example #7
0
 public void PartialPush()
 {
     FormsAssert.IsTrue(button.Style == ToolBarButtonStyle.ToggleButton);
     PartialPushed = !PartialPushed;
 }