/// <summary> /// Specify which control or form we should use for the relative position. /// </summary> /// <param name="control"> /// A <see cref="ControlTester"/>. /// </param> public void UseOn(ControlTester control) { if (mouseControl == null) { Win32.Point position; Win32.GetCursorPos(out position); originalPosition = new Point(position.x, position.y); } if (control == null) { throw new ArgumentNullException("control"); } mouseControl = new MouseControl(control); PositionUnit = GraphicsUnit.Pixel; // Block any user input while we are active. if (!restoreUserInput) { if (!Win32.BlockInput(true)) { //TODO Bart De Boeck : Waarom is dit nodig ? Zie ook in Dispose(). //throw new Win32Exception(); } restoreUserInput = true; } }
public ControlTester(ControlTester tester, int index) { if (index < 0) { throw new Exception("Should not have index < 0"); } this.index = index; form = tester.form; formName = tester.formName; name = tester.name; }
protected ControlTester GetTester() { ControlTester tester = new ControlTester(control); Type testerType = (Type)testerTypes[tester.Control.GetType()]; if (testerType == null) { return(tester); } return((ControlTester)Activator.CreateInstance(testerType, new object[] { control })); }
/// <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(ControlTester control) { if (control == null) { throw new ArgumentNullException("control"); } keyboardControl = new KeyboardControl(control); if (!restoreUserInput) { //if this next line returns false, I used to throw an exception... Win32.BlockInput(true); restoreUserInput = true; } }
public override void Execute(Speed speed) { SlowDownAndPaint(speed); ControlTester tester = GetTester(); try { MethodInfo methodInfo = tester.GetType().GetMethod(Action, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); methodInfo.Invoke(tester, new object[] { Args }); } catch (Exception e) { throw new FormsTestAssertionException( string.Format("Line Number {0} : {1} : {2}", LineNumber, e.Message, e.StackTrace)); } SlowDownAndPaint(speed); }
/// <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(ControlTester control) { if(control == null) { throw new ArgumentNullException("control"); } keyboardControl = new KeyboardControl(control); if(!restoreUserInput) { //if this next line returns false, I used to throw an exception... Win32.BlockInput(true); restoreUserInput = true; } }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public ListViewTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public RichTextBoxTester(ControlTester tester, int index) : base(tester, index) { }
internal MouseControl(ControlTester controlTester) { this.controlTester = controlTester; }
///<summary> /// Verifies the text of the named control matches the expected text. ///</summary> public void VerifyText(string controlName, string expectedText) { ControlTester anyControl = new ControlTester(controlName, targetForm.Properties); Assert.AreEqual(expectedText, anyControl.Text); }
/// <summary> /// Creates a keyboard controller and sets the focus on the control /// indicated by the supplied ControlTester. /// </summary> /// <param name="controlTester">The ControlTester to use the keyboard /// on.</param> public KeyboardController(ControlTester controlTester) { UseOn(controlTester); }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public TreeViewTester(ControlTester tester, int index) : base(tester, index) { }
private void ClickStarOfLexemeForm() { ControlTester t = new ControlTester(GetNameOfLexicalFormAnnotationControl(), _window); t.Click(); GetEditControl(Field.FieldNames.EntryLexicalForm.ToString()); }
private static void PressCtrlN(ControlTester t) { using (KeyboardController kc = new KeyboardController(t)) { kc.Press("^n"); // Ctrl+N } }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public TabControlTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public ComboBoxTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public ToolBarTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public LabelTester(ControlTester tester, int index) : base(tester, index) { }
public CheckBoxTester(ControlTester <CheckBox, CheckBoxTester> tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public ButtonTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates and initialises a new instance of the class for the specified <see cref="ControlTester"/>. /// </summary> /// <param name="controlTester"> /// A <see cref="ControlTester"/>. /// </param> /// <remarks> /// The <see cref="Position">mouse position</see> is relative to the <see cref="Control"/> managed by /// the <paramref name="controlTester"/>. /// <para> /// While the <b>MouseController</b> is active, user keyboard and mouse input is disabled. For this /// reason the <b>MouseController</b> should be disposed of when the testing is concluded. /// </para> /// </remarks> /// <example> /// <code> /// using (MouseController mouse = new MouseControler(myTestControl)) /// { /// mouse.Position = new PointF(1,1); /// mouse.Press(MouseButtons.Middle); /// } /// </code> /// </example> public MouseController(ControlTester controlTester) { UseOn(controlTester); }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public RadioButtonTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Specify which control or form we should use for the relative position. /// </summary> /// <param name="control"> /// A <see cref="ControlTester"/>. /// </param> public void UseOn(ControlTester control) { if(mouseControl == null) { Win32.Point position; Win32.GetCursorPos(out position); originalPosition = new Point(position.x, position.y); } if(control == null) { throw new ArgumentNullException("control"); } mouseControl = new MouseControl(control); PositionUnit = GraphicsUnit.Pixel; // Block any user input while we are active. if(!restoreUserInput) { if(!Win32.BlockInput(true)) { //TODO Bart De Boeck : Waarom is dit nodig ? Zie ook in Dispose(). //throw new Win32Exception(); } restoreUserInput = true; } }
internal KeyboardControl(ControlTester controlTester) { this.controlTester = controlTester; }
public RichTextBoxTester(ControlTester <RichTextBox, RichTextBoxTester> tester, int index) : base(tester, index) { }
/// <summary> /// Creates a keyboard controller and sets the focus on the control /// indicated by the supplied ControlTester. /// </summary> /// <param name="controlTester">The ControlTester to use the keyboard /// on.</param> public KeyboardController(ControlTester controlTester) : this(new OldSendKeysFactory()) { UseOn(controlTester); }
protected ControlTester GetTester() { ControlTester tester = new ControlTester(control); Type testerType = (Type) testerTypes[tester.Control.GetType()]; if(testerType == null) { return tester; } return (ControlTester) Activator.CreateInstance(testerType, new object[] {control}); }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public CheckedListBoxTester(ControlTester tester, int index) : base(tester, index) { }
public ControlTester(ControlTester <T, TThis> tester, int index) : base(tester, index) { }
public ControlTester(ControlTester tester, int index) { if(index < 0) { throw new Exception("Should not have index < 0"); } this.index = index; form = tester.form; formName = tester.formName; name = tester.name; }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public CheckBoxTester(ControlTester tester, int index) : base(tester, index) { }
/// <summary> /// Creates a ControlTester from a ControlTester and an index where the /// original tester's name is not unique. /// </summary> /// <remarks> /// It is best to use the overloaded Constructor that requires just the name /// parameter if possible. /// </remarks> /// <param name="tester">The ControlTester.</param> /// <param name="index">The index to test.</param> public TextBoxTester(ControlTester tester, int index) : base(tester, index) { }
public override void Setup() { _form = new MainForm(); _form.Show(); _ctrl = new ControlTester("ctlSceneView"); }