public void LabeledByTest() { MockProvider mockWindow = new MockProvider(); mockWindow.SetPropertyValue(AEIds.ControlTypeProperty.Id, ControlType.Window.Id); mockWindow.SetPropertyValue(AEIds.NativeWindowHandleProperty.Id, new IntPtr(1234)); string labelText = "label text"; MockProvider mockLabel = new MockProvider(); mockLabel.SetPropertyValue(AEIds.ControlTypeProperty.Id, ControlType.Text.Id); mockLabel.SetPropertyValue(AEIds.NameProperty.Id, labelText); //string buttonText = "click me"; MockProvider mockButton = new MockProvider(); mockButton.SetPropertyValue(AEIds.ControlTypeProperty.Id, ControlType.Button.Id); AddProvider(mockWindow); AddProvider(mockLabel); AddProvider(mockButton); string windowPath = "/org/mono/UIAutomation/Element/1"; string labelPath = "/org/mono/UIAutomation/Element/2"; string buttonPath = "/org/mono/UIAutomation/Element/3"; string ourBus = TestHelper.CurrentBus; IAutomationElement windowElement = TestHelper.GetElement(ourBus, windowPath); IAutomationElement labelElement = TestHelper.GetElement(ourBus, labelPath); IAutomationElement buttonElement = TestHelper.GetElement(ourBus, buttonPath); // Verify that we matched up our elements correctly Assert.AreEqual(ControlType.Window.Id, windowElement.ControlTypeId, "Window ControlType"); Assert.AreEqual(ControlType.Text.Id, labelElement.ControlTypeId, "Label ControlType"); Assert.AreEqual(ControlType.Button.Id, buttonElement.ControlTypeId, "Button ControlType"); // Test LabeledBy Initial Value Assert.AreEqual(string.Empty, buttonElement.LabeledByElementPath, "Default LabeledBy value"); // Test with LabeledBy Property Set mockButton.SetPropertyValue(AEIds.LabeledByProperty.Id, mockLabel); Assert.AreEqual(labelPath, buttonElement.LabeledByElementPath, "Button should be LabeledBy label element now"); }
private IAutomationElement SetupBasicWindowElement(MockProvider mockWindow) { mockWindow.SetPropertyValue(AEIds.ControlTypeProperty.Id, ControlType.Window.Id); mockWindow.SetPropertyValue(AEIds.NativeWindowHandleProperty.Id, new IntPtr(1234)); AddProvider(mockWindow); string ourBus = TestHelper.CurrentBus; string windowPath = "/org/mono/UIAutomation/Element/1"; IAutomationElement windowElement = TestHelper.GetElement(ourBus, windowPath); return(windowElement); }
public void BoundingRectangleTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(new DC.Rect(SW.Rect.Empty), windowElement.BoundingRectangle, "Initial value"); // Test set value SW.Rect testVal = new SW.Rect(5, 6, 7, 8); mockWindow.SetPropertyValue(AEIds.BoundingRectangleProperty.Id, testVal); Assert.AreEqual(new DC.Rect(testVal), windowElement.BoundingRectangle, "Set value"); }
public void LocalizedControlTypeTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.LocalizedControlType, "Initial value"); // Test set value object testVal = ControlType.Window.LocalizedControlType; mockWindow.SetPropertyValue(AEIds.LocalizedControlTypeProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.LocalizedControlType, "Set value"); }
public void ItemTypeTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.ItemType, "Initial value"); // Test set value object testVal = "extra special window type"; mockWindow.SetPropertyValue(AEIds.ItemTypeProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.ItemType, "Set value"); }
public void ItemStatusTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.ItemStatus, "Initial value"); // Test set value object testVal = "all systems go"; mockWindow.SetPropertyValue(AEIds.ItemStatusProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.ItemStatus, "Set value"); }
public void IsRequiredForFormTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(false, windowElement.IsRequiredForForm, "Initial value"); // Test set value object testVal = true; mockWindow.SetPropertyValue(AEIds.IsRequiredForFormProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.IsRequiredForForm, "Set value"); }
public void HelpTextTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.HelpText, "Initial value"); // Test set value object testVal = "Sample Help Text"; mockWindow.SetPropertyValue(AEIds.HelpTextProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.HelpText, "Set value"); }
public void ClickablePointTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(new DC.Point(new SW.Point(double.NegativeInfinity, double.NegativeInfinity)), windowElement.ClickablePoint, "Initial value"); // Test set value SW.Point testVal = new SW.Point(7, 8); mockWindow.SetPropertyValue(AEIds.ClickablePointProperty.Id, testVal); Assert.AreEqual(new DC.Point(testVal), windowElement.ClickablePoint, "Set value"); }
public void NameTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.Name, "Initial value"); // Test set value object testVal = "my cool window"; mockWindow.SetPropertyValue(AEIds.NameProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.Name, "Set value"); }
public void AcceleratorKeyTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.AcceleratorKey, "Initial value"); // Test set value object testVal = "alt+s"; mockWindow.SetPropertyValue(AEIds.AcceleratorKeyProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.AcceleratorKey, "Set value"); }
public void AutomationIdTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(string.Empty, windowElement.AutomationId, "Initial value"); // Test set value int testVal = 3254; mockWindow.SetPropertyValue(AEIds.AutomationIdProperty.Id, testVal); Assert.AreEqual(testVal.ToString(), windowElement.AutomationId, "Set value"); }
public void RuntimeIdTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(0, windowElement.RuntimeId.Length, "Initial value"); // Test set value object testVal = new int [] { 5, 6 }; mockWindow.SetPropertyValue(AEIds.RuntimeIdProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.RuntimeId, "Set value"); }
public void OrientationTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(OrientationType.None, windowElement.Orientation, "Initial value"); // Test set value object testVal = OrientationType.Horizontal; mockWindow.SetPropertyValue(AEIds.OrientationProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.Orientation, "Set value"); }
public void ProcessIdTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); // Test initial value Assert.AreEqual(-1, windowElement.ProcessId, "Initial value"); // Test set value object testVal = 64523; mockWindow.SetPropertyValue(AEIds.ProcessIdProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.ProcessId, "Set value"); }
public void NativeWindowHandleTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); IntPtr originalPtr = (IntPtr) mockWindow.GetPropertyValue(AEIds.NativeWindowHandleProperty.Id); // Test initial value mockWindow.SetPropertyValue(AEIds.NativeWindowHandleProperty.Id, null); Assert.AreEqual(0, windowElement.NativeWindowHandle, "Initial value"); // Test set value mockWindow.SetPropertyValue(AEIds.NativeWindowHandleProperty.Id, originalPtr); Assert.AreEqual(originalPtr.ToInt32(), windowElement.NativeWindowHandle, "Set value"); }
public void ControlTypeTest() { MockProvider mockWindow = new MockProvider(); IAutomationElement windowElement = SetupBasicWindowElement(mockWindow); mockWindow.SetPropertyValue(AEIds.ControlTypeProperty.Id, null); // Test initial value Assert.AreEqual(-1, windowElement.ControlTypeId, "Initial value"); // Test set value object testVal = ControlType.Window.Id; mockWindow.SetPropertyValue(AEIds.ControlTypeProperty.Id, testVal); Assert.AreEqual(testVal, windowElement.ControlTypeId, "Set value"); }
public void LocalizedControlTypeTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.LocalizedControlType, "Initial value"); // Test set value object testVal = ControlType.Window.LocalizedControlType; mockWindow.SetPropertyValue (AEIds.LocalizedControlTypeProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.LocalizedControlType, "Set value"); }
public void ItemTypeTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.ItemType, "Initial value"); // Test set value object testVal = "extra special window type"; mockWindow.SetPropertyValue (AEIds.ItemTypeProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.ItemType, "Set value"); }
public void ItemStatusTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.ItemStatus, "Initial value"); // Test set value object testVal = "all systems go"; mockWindow.SetPropertyValue (AEIds.ItemStatusProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.ItemStatus, "Set value"); }
public void IsRequiredForFormTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (false, windowElement.IsRequiredForForm, "Initial value"); // Test set value object testVal = true; mockWindow.SetPropertyValue (AEIds.IsRequiredForFormProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.IsRequiredForForm, "Set value"); }
public void HelpTextTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.HelpText, "Initial value"); // Test set value object testVal = "Sample Help Text"; mockWindow.SetPropertyValue (AEIds.HelpTextProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.HelpText, "Set value"); }
public void OrientationTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (OrientationType.None, windowElement.Orientation, "Initial value"); // Test set value object testVal = OrientationType.Horizontal; mockWindow.SetPropertyValue (AEIds.OrientationProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.Orientation, "Set value"); }
public void BoundingRectangleTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (new DC.Rect (SW.Rect.Empty), windowElement.BoundingRectangle, "Initial value"); // Test set value SW.Rect testVal = new SW.Rect (5, 6, 7, 8); mockWindow.SetPropertyValue (AEIds.BoundingRectangleProperty.Id, testVal); Assert.AreEqual (new DC.Rect (testVal), windowElement.BoundingRectangle, "Set value"); }
public void AutomationIdTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.AutomationId, "Initial value"); // Test set value int testVal = 3254; mockWindow.SetPropertyValue (AEIds.AutomationIdProperty.Id, testVal); Assert.AreEqual (testVal.ToString (), windowElement.AutomationId, "Set value"); }
public void AcceleratorKeyTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.AcceleratorKey, "Initial value"); // Test set value object testVal = "alt+s"; mockWindow.SetPropertyValue (AEIds.AcceleratorKeyProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.AcceleratorKey, "Set value"); }
public void RuntimeIdTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (0, windowElement.RuntimeId.Length, "Initial value"); // Test set value object testVal = new int [] {5, 6}; mockWindow.SetPropertyValue (AEIds.RuntimeIdProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.RuntimeId, "Set value"); }
public void NameTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (string.Empty, windowElement.Name, "Initial value"); // Test set value object testVal = "my cool window"; mockWindow.SetPropertyValue (AEIds.NameProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.Name, "Set value"); }
public void NativeWindowHandleTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); IntPtr originalPtr = (IntPtr) mockWindow.GetPropertyValue (AEIds.NativeWindowHandleProperty.Id); // Test initial value mockWindow.SetPropertyValue (AEIds.NativeWindowHandleProperty.Id, null); Assert.AreEqual (0, windowElement.NativeWindowHandle, "Initial value"); // Test set value mockWindow.SetPropertyValue (AEIds.NativeWindowHandleProperty.Id, originalPtr); Assert.AreEqual (originalPtr.ToInt32 (), windowElement.NativeWindowHandle, "Set value"); }
public void ClickablePointTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (new DC.Point (new SW.Point (double.NegativeInfinity, double.NegativeInfinity)), windowElement.ClickablePoint, "Initial value"); // Test set value SW.Point testVal = new SW.Point (7, 8); mockWindow.SetPropertyValue (AEIds.ClickablePointProperty.Id, testVal); Assert.AreEqual (new DC.Point (testVal), windowElement.ClickablePoint, "Set value"); }
public void ProcessIdTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); // Test initial value Assert.AreEqual (-1, windowElement.ProcessId, "Initial value"); // Test set value object testVal = 64523; mockWindow.SetPropertyValue (AEIds.ProcessIdProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.ProcessId, "Set value"); }
public void ControlTypeTest () { MockProvider mockWindow = new MockProvider (); IAutomationElement windowElement = SetupBasicWindowElement (mockWindow); mockWindow.SetPropertyValue (AEIds.ControlTypeProperty.Id, null); // Test initial value Assert.AreEqual (-1, windowElement.ControlTypeId, "Initial value"); // Test set value object testVal = ControlType.Window.Id; mockWindow.SetPropertyValue (AEIds.ControlTypeProperty.Id, testVal); Assert.AreEqual (testVal, windowElement.ControlTypeId, "Set value"); }
private IAutomationElement SetupBasicWindowElement (MockProvider mockWindow) { mockWindow.SetPropertyValue (AEIds.ControlTypeProperty.Id, ControlType.Window.Id); mockWindow.SetPropertyValue (AEIds.NativeWindowHandleProperty.Id, new IntPtr (1234)); AddProvider (mockWindow); string ourBus = TestHelper.CurrentBus; string windowPath = "/org/mono/UIAutomation/Element/1"; IAutomationElement windowElement = TestHelper.GetElement (ourBus, windowPath); return windowElement; }
public void LabeledByTest () { MockProvider mockWindow = new MockProvider (); mockWindow.SetPropertyValue (AEIds.ControlTypeProperty.Id, ControlType.Window.Id); mockWindow.SetPropertyValue (AEIds.NativeWindowHandleProperty.Id, new IntPtr (1234)); string labelText = "label text"; MockProvider mockLabel = new MockProvider (); mockLabel.SetPropertyValue (AEIds.ControlTypeProperty.Id, ControlType.Text.Id); mockLabel.SetPropertyValue (AEIds.NameProperty.Id, labelText); //string buttonText = "click me"; MockProvider mockButton = new MockProvider (); mockButton.SetPropertyValue (AEIds.ControlTypeProperty.Id, ControlType.Button.Id); AddProvider (mockWindow); AddProvider (mockLabel); AddProvider (mockButton); string windowPath = "/org/mono/UIAutomation/Element/1"; string labelPath = "/org/mono/UIAutomation/Element/2"; string buttonPath = "/org/mono/UIAutomation/Element/3"; string ourBus = TestHelper.CurrentBus; IAutomationElement windowElement = TestHelper.GetElement (ourBus, windowPath); IAutomationElement labelElement = TestHelper.GetElement (ourBus, labelPath); IAutomationElement buttonElement = TestHelper.GetElement (ourBus, buttonPath); // Verify that we matched up our elements correctly Assert.AreEqual (ControlType.Window.Id, windowElement.ControlTypeId, "Window ControlType"); Assert.AreEqual (ControlType.Text.Id, labelElement.ControlTypeId, "Label ControlType"); Assert.AreEqual (ControlType.Button.Id, buttonElement.ControlTypeId, "Button ControlType"); // Test LabeledBy Initial Value Assert.AreEqual (string.Empty, buttonElement.LabeledByElementPath, "Default LabeledBy value"); // Test with LabeledBy Property Set mockButton.SetPropertyValue (AEIds.LabeledByProperty.Id, mockLabel); Assert.AreEqual (labelPath, buttonElement.LabeledByElementPath, "Button should be LabeledBy label element now"); }