Beispiel #1
0
 public WinFormsTripled(
     ControlToForm[] controls) : base ("WinFormsTripled", "WinFormsTripled", controls)
 {
     ChildForm = this;
     
     neededControls = controls;
 }
        public void GetControl_Win32_X2_SearchInValue_Timeout2000()
        {
            string expectedValue = "my text";

            System.Collections.ArrayList arrList =
                new System.Collections.ArrayList();
            ControlToForm ctf1 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "1",
                    "auid1",
                    0);

            arrList.Add(ctf1);
            ControlToForm ctf2 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "2",
                    "auid2",
                    0);

            arrList.Add(ctf2);
            ControlToForm ctf3 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "3",
                    "auid3",
                    0);

            arrList.Add(ctf3);

            MiddleLevelCode.StartProcessWithFormAndControl(
                UIAutomationTestForms.Forms.WinFormsEmpty,
                0,
                (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"$null = Get-UiaWindow -n " +
                MiddleLevelCode.TestFormNameEmpty +
                " | Get-UiaControl -AutomationId auid1 | Set-UiaControlText '" +
                expectedValue +
                "'; " +
                "$null = Get-UiaControl -AutomationId auid3 | Set-UiaControlText '" +
                expectedValue +
                "'; " +
                "(Get-UiaControl '" +
                expectedValue +
                "' -Win32 -Timeout 2000).Count;",
                "2");
        }
        public void GetControl_X2_SearchInName_Timeout2000()
        {
            string expectedName = "my_name";

            System.Collections.ArrayList arrList =
                new System.Collections.ArrayList();
            ControlToForm ctf1 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Button,
                    expectedName,
                    "1",
                    0);

            arrList.Add(ctf1);
            ControlToForm ctf2 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Button,
                    "e2",
                    "2",
                    0);

            arrList.Add(ctf2);
            ControlToForm ctf3 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Button,
                    expectedName,
                    "3",
                    0);

            arrList.Add(ctf3);

            MiddleLevelCode.StartProcessWithFormAndControl(
                UIAutomationTestForms.Forms.WinFormsEmpty,
                0,
                (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"(Get-UiaWindow -n " +
                MiddleLevelCode.TestFormNameEmpty +
                " | Get-UiaControl '" +
                expectedName +
                "' -Timeout 2000).Count;",
                "2");
        }
        public void GetControl_Win32_X2_SearchInAutomationIdClassName_Timeout2000()
        {
            string expectedClass = "button";

            System.Collections.ArrayList arrList =
                new System.Collections.ArrayList();
            ControlToForm ctf1 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "aaa",
                    expectedClass,
                    0);

            arrList.Add(ctf1);
            ControlToForm ctf2 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "bbb",
                    "auid2",
                    0);

            arrList.Add(ctf2);
            ControlToForm ctf3 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Button,
                    "ccc",
                    expectedClass,
                    0);

            arrList.Add(ctf3);

            MiddleLevelCode.StartProcessWithFormAndControl(
                UIAutomationTestForms.Forms.WinFormsEmpty,
                0,
                (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"(Get-UiaWindow -n " +
                MiddleLevelCode.TestFormNameEmpty +
                " | Get-UiaControl '" +
                expectedClass +
                "' -Win32 -Timeout 2000).Count;",
                "2");
        }
Beispiel #5
0
        // the same as InvokeSelectItem_RadioButton()
        public void InvokeSelectionItemState_RadioButton()
        {
            string        name1          = "RadioButton1";
            string        auId1          = "rb111";
            string        name2          = "RadioButton2";
            string        auId2          = "rb222";
            string        expectedResult = "True";
            ControlToForm ctf            =
                new ControlToForm(
                    System.Windows.Automation.ControlType.RadioButton,
                    name1,
                    auId1,
                    TimeoutsAndDelays.Control_Delay0);

            System.Collections.ArrayList arrList =
                new System.Collections.ArrayList();
            arrList.Add(ctf);
            ctf =
                new ControlToForm(
                    System.Windows.Automation.ControlType.RadioButton,
                    name2,
                    auId2,
                    TimeoutsAndDelays.Control_Delay0);
            arrList.Add(ctf);
            MiddleLevelCode.StartProcessWithFormAndControl(
                UIAutomationTestForms.Forms.WinFormsEmpty,
                0,
                (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"$null = Get-UiaWindow -pn " +
                MiddleLevelCode.TestFormProcess +
                " | Get-UiaRadioButton -AutomationId '" +
                auId1 +
                "' | Invoke-UiaRadioButtonSelectItem -ItemName '" +
                name1 +
                @"';" +
                @"Get-UiaRadioButton -AutomationId '" +
                auId1 +
                "' | Get-UiaRadioButtonSelectionItemState;",
                expectedResult);
        }
 // the same as InvokeSelectItem_RadioButton()
 public void InvokeSelectionItemState_RadioButton()
 {
     string name1 = "RadioButton1";
     string auId1 = "rb111";
     string name2 = "RadioButton2";
     string auId2 = "rb222";
     string expectedResult = "True";
     ControlToForm ctf = 
         new ControlToForm(
             System.Windows.Automation.ControlType.RadioButton,
             name1,
             auId1, 
             TimeoutsAndDelays.Control_Delay0);
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     arrList.Add(ctf);
     ctf = 
         new ControlToForm(
             System.Windows.Automation.ControlType.RadioButton,
             name2,
             auId2, 
             TimeoutsAndDelays.Control_Delay0);
     arrList.Add(ctf);
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"$null = Get-UiaWindow -pn " + 
         MiddleLevelCode.TestFormProcess +
         " | Get-UiaRadioButton -AutomationId '" + 
         auId1 + 
         "' | Invoke-UiaRadioButtonSelectItem -ItemName '" + 
         name1 +
         @"';" +
         @"Get-UiaRadioButton -AutomationId '" + 
         auId1 + 
         "' | Get-UiaRadioButtonSelectionItemState;",
         expectedResult);
 }
 public void GetControl_X2_SearchInName_Timeout2000()
 {
     string expectedName = "my_name";
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     ControlToForm ctf1 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Button,
             expectedName,
             "1", 
             0);
     arrList.Add(ctf1);
     ControlToForm ctf2 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Button,
             "e2",
             "2", 
             0);
     arrList.Add(ctf2);
     ControlToForm ctf3 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Button,
             expectedName,
             "3", 
             0);
     arrList.Add(ctf3);
     
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"(Get-UiaWindow -n " + 
         MiddleLevelCode.TestFormNameEmpty +
         " | Get-UiaControl '" +
         expectedName +
         "' -Timeout 2000).Count;",
         "2");
 }
        public void GetControl_Win32_X2_SearchInAutomationIdClassName_Timeout2000()
        {
            string expectedClass = "button";
            System.Collections.ArrayList arrList =
                new System.Collections.ArrayList();
            ControlToForm ctf1 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "aaa",
                    expectedClass,
                    0);
            arrList.Add(ctf1);
            ControlToForm ctf2 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Edit,
                    "bbb",
                    "auid2",
                    0);
            arrList.Add(ctf2);
            ControlToForm ctf3 =
                new ControlToForm(
                    System.Windows.Automation.ControlType.Button,
                    "ccc",
                    expectedClass,
                    0);
            arrList.Add(ctf3);

            MiddleLevelCode.StartProcessWithFormAndControl(
                UIAutomationTestForms.Forms.WinFormsEmpty,
                0,
                (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"(Get-UIAWindow -n " +
                MiddleLevelCode.TestFormNameEmpty +
                " | Get-UIAControl '" +
                expectedClass +
                "' -Win32 -Timeout 2000).Count;",
                "2");
        }
Beispiel #9
0
 public WinFormsMaximized(
     ControlToForm[] controls) : base ("WinFormsMaximized", "WinFormsMaximized", controls)
 {
     ChildForm = this;
 }        
Beispiel #10
0
 public WinFormsNoTaskBar(
     ControlToForm[] controls) : base ("WinFormsNoTaskBar", "WinFormsNoTaskBar", controls)
 {
     ChildForm = this;
 }
 public void GetControlByAutomationId_WildCard2_Timeout2000Delay4000()
 {
     string name = "controlN[a-z]me";
     string auId = "?d&d*";
     string auIdToSearch = "*[?]d*d*";
     ControlToForm ctf = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Button,
             name,
             auId, 
             TimeoutsAndDelays.Control_Timeout2000Delay4000_Delay);
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     arrList.Add(ctf);
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"Get-UiaWindow -n " + 
         MiddleLevelCode.TestFormNameEmpty +
         " | Get-UiaControl -ControlType Button -AutomationId " + 
         auIdToSearch +
         " -timeout 2000 | Read-UiaControlAutomationId;",
         auId);
 }
 public void GetControlByName_WildCard4_Timeout2000Delay4000()
 {
     string name = "co?ntro*NaME";
     string nameToSearch = "co*tro*ame";
     string auId = "au*";
     ControlToForm ctf = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Text,
             name,
             auId, 
             TimeoutsAndDelays.Control_Timeout2000Delay4000_Delay);
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     arrList.Add(ctf);
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"Get-UiaWindow -n " + 
         MiddleLevelCode.TestFormNameEmpty +
         " | Get-UiaLabel -Name " + 
         nameToSearch +
         " -timeout 2000 | Read-UiaControlName;",
         name);
 }
 public void GetControlByValueX2_WildCard_TimeoutDefault()
 {
     string auId1 = "Edit1";
     string auId2 = "Edit2";
     string expectedValue = "my text";
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     ControlToForm ctf1 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Edit,
             "e1",
             auId1, 
             0);
     arrList.Add(ctf1);
     ControlToForm ctf2 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Edit,
             "e2",
             auId2, 
             0);
     arrList.Add(ctf2);
     
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"$null = Get-UiaWindow -n " + 
         MiddleLevelCode.TestFormNameEmpty +
         " | Get-UiaControl -AutomationId Edit* | Set-UiaEditText -Text '" + 
         expectedValue +
         "'; Get-UiaEdit -Value '" +
         expectedValue +
         "' | Get-UiaEditText;",
         expectedValue);
 }
Beispiel #14
0
 public WinFormsSecond(
     ControlToForm[] controls) : base ("WinFormsSecond", "WinFormsSecond", controls)
 {
     ChildForm = this;
 }
 public void GetControl_Win32_X2_SearchInValue_Timeout2000()
 {
     string expectedValue = "my text";
     System.Collections.ArrayList arrList = 
         new System.Collections.ArrayList();
     ControlToForm ctf1 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Edit,
             "1",
             "auid1", 
             0);
     arrList.Add(ctf1);
     ControlToForm ctf2 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Edit,
             "2",
             "auid2", 
             0);
     arrList.Add(ctf2);
     ControlToForm ctf3 = 
         new ControlToForm(
             System.Windows.Automation.ControlType.Edit,
             "3",
             "auid3", 
             0);
     arrList.Add(ctf3);
     
     MiddleLevelCode.StartProcessWithFormAndControl(
         UIAutomationTestForms.Forms.WinFormsEmpty, 
         0,
         (ControlToForm[])arrList.ToArray(typeof(ControlToForm)));
     CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
         @"$null = Get-UiaWindow -n " + 
         MiddleLevelCode.TestFormNameEmpty +
         " | Get-UiaControl -AutomationId auid1 | Set-UiaControlText '" + 
         expectedValue +
         "'; " +
         "$null = Get-UiaControl -AutomationId auid3 | Set-UiaControlText '" + 
         expectedValue +
         "'; " +
         "(Get-UiaControl '" +
         expectedValue +
         "' -Win32 -Timeout 2000).Count;",
         "2");
 }
Beispiel #16
0
 public WinFormsAnonymous(
     ControlToForm[] controls) : base ("WinFormsAnonymous", "WinFormsAnonymous", controls)
 {
     ChildForm = this;
 }
Beispiel #17
0
 public WinFormsEmpty(
     ControlToForm[] controls) : base ("WinFormsEmpty", "WinFormsEmpty", controls)
 {
     ChildForm = this;
 }