public void GetWidgetByNameTestNoRegionSingleWindow() { // single system window { int leftClickCount = 0; Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(); testRunner.ClickByName("left"); testRunner.Wait(.5); resultsHarness.AddTestResult(leftClickCount == 1, "Got left button click"); }; SystemWindow buttonContainer = new SystemWindow(300, 200); Button leftButton = new Button("left", 10, 40); leftButton.Name = "left"; leftButton.Click += (sender, e) => { leftClickCount++; }; buttonContainer.AddChild(leftButton); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 1); // make sure we can all our tests } }
public void VerifyFocusMakesTextWidgetEditable() { TextEditWidget editField = null; SystemWindow systemWindow = new SystemWindow(300, 200) { BackgroundColor = RGBA_Bytes.Black, }; Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { UiThread.RunOnIdle(editField.Focus); AutomationRunner testRunner = new AutomationRunner(); testRunner.Wait(1); // Now do the actions specific to this test. (replace this for new tests) testRunner.Type("Test Text"); resultsHarness.AddTestResult(editField.Text == "Test Text", "validate text is typed"); systemWindow.CloseOnIdle(); }; editField = new TextEditWidget(pixelWidth: 200) { HAnchor = HAnchor.ParentCenter, VAnchor = VAnchor.ParentCenter, }; systemWindow.AddChild(editField); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(systemWindow, testToRun, 10); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 1); // make sure we can all our tests }
public void ToolTipsShow() { SystemWindow buttonContainer = new SystemWindow(300, 200) { BackgroundColor = RGBA_Bytes.White, }; Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner("C:/TestImages"); testRunner.Wait(1); // Now do the actions specific to this test. (replace this for new tests) { testRunner.MoveToByName("ButtonWithToolTip"); testRunner.Wait(1.5); GuiWidget toolTipWidget = buttonContainer.FindNamedChildRecursive("ToolTipWidget"); resultsHarness.AddTestResult(toolTipWidget != null, "Tool tip is showing"); testRunner.MoveToByName("right"); toolTipWidget = buttonContainer.FindNamedChildRecursive("ToolTipWidget"); resultsHarness.AddTestResult(toolTipWidget == null, "Tool tip is not showing"); } testRunner.Wait(1); buttonContainer.CloseOnIdle(); }; Button leftButton = new Button("left", 10, 40); leftButton.Name = "ButtonWithToolTip"; leftButton.ToolTipText = "Left Tool Tip"; buttonContainer.AddChild(leftButton); Button rightButton = new Button("right", 110, 40); rightButton.Name = "right"; buttonContainer.AddChild(rightButton); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10000); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we can all our tests }
public void SelectAllOnFocusCanStillClickAfterSelection() { TextEditWidget editField = null; SystemWindow systemWindow = new SystemWindow(300, 200) { BackgroundColor = RGBA_Bytes.Black, }; Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { editField.SelectAllOnFocus = true; AutomationRunner testRunner = new AutomationRunner(); testRunner.Wait(1); resultsHarness.AddTestResult(testRunner.ClickByName(editField.Name, 1)); editField.SelectAllOnFocus = true; testRunner.Type("123"); resultsHarness.AddTestResult(editField.Text == "123", "on enter we have selected all and replaced the text"); resultsHarness.AddTestResult(testRunner.ClickByName(editField.Name, 1)); testRunner.Type("123"); resultsHarness.AddTestResult(editField.Text == "123123", "we already have the contol selected so don't select all again."); systemWindow.CloseOnIdle(); }; editField = new TextEditWidget(pixelWidth: 200) { Name = "editField", Text = "Some Text", HAnchor = HAnchor.ParentCenter, VAnchor = VAnchor.ParentCenter, }; systemWindow.AddChild(editField); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(systemWindow, testToRun, 15); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 4); // make sure we can all our tests }