public void ComboBoxItemAccessibleObject_GetOffScreenProperty_ReturnExpected()
        {
            using ComboBox comboBox = GetComboBoxWithMaxSize(ComboBoxStyle.Simple);

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem3 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem2
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);

            AssertExtensions.True(comboBoxItem1, UiaCore.UIA.IsOffscreenPropertyId);  // comboBoxItem1 above the visible area
            AssertExtensions.False(comboBoxItem2, UiaCore.UIA.IsOffscreenPropertyId); // comboBoxItem2 in the visible area
            AssertExtensions.True(comboBoxItem3, UiaCore.UIA.IsOffscreenPropertyId);  // comboBoxItem3 below the visible area
        }
        public void ComboBoxItemAccessibleObject_SeveralSameItems_FragmentNavigate_NextSibling_ReturnExpected(ComboBoxStyle comboBoxStyle)
        {
            using ComboBox comboBox = new ComboBox
                  {
                      DropDownStyle = comboBoxStyle
                  };

            comboBox.Items.AddRange(new[] { "aaa", "aaa", "aaa" });
            comboBox.CreateControl();

            ComboBoxItemAccessibleObjectCollection itemAccessibleObjects = ((ComboBox.ComboBoxAccessibleObject)comboBox.AccessibilityObject).ItemAccessibleObjects;

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            Assert.Equal("aaa", comboBoxItem1.Name);
            Assert.Equal(comboBoxItem1, itemAccessibleObjects.GetComboBoxItemAccessibleObject(comboBox.Items.InnerList[0]));

            // FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling) should return accessible object for second "aaa" item
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
            Assert.NotEqual(comboBoxItem1, comboBoxItem2);
            Assert.Equal("aaa", comboBoxItem2.Name);
            Assert.Equal(comboBoxItem2, itemAccessibleObjects.GetComboBoxItemAccessibleObject(comboBox.Items.InnerList[1]));

            // FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling) should return accessible object for third "aaa" item
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem3 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem2
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
            Assert.NotEqual(comboBoxItem3, comboBoxItem2);
            Assert.NotEqual(comboBoxItem3, comboBoxItem1);
            Assert.Equal("aaa", comboBoxItem3.Name);
            Assert.Equal(comboBoxItem3, itemAccessibleObjects.GetComboBoxItemAccessibleObject(comboBox.Items.InnerList[2]));

            Assert.True(comboBox.IsHandleCreated);
        }
        public void ComboBoxItemAccessibleObject_DropDownCollapsed_GetOffScreenProperty_ReturnExpected(ComboBoxStyle comboBoxStyle)
        {
            using ComboBox comboBox = GetComboBox(comboBoxStyle);

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);

            AssertExtensions.True(comboBoxItem1, UiaCore.UIA.IsOffscreenPropertyId);
            AssertExtensions.True(comboBoxItem2, UiaCore.UIA.IsOffscreenPropertyId);
        }
        public void ComboBoxItemAccessibleObject_State_ReturnExpected()
        {
            using ComboBox comboBox = GetComboBoxWithMaxSize(ComboBoxStyle.Simple);

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem3 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem2
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);

            AccessibleStates itemState = AccessibleStates.Invisible | AccessibleStates.Selected | AccessibleStates.Focusable | AccessibleStates.Selectable;

            Assert.Equal(comboBoxItem1.State, InvisibleItemState); // comboBoxItem1 above the visible area
            Assert.Equal(comboBoxItem2.State, itemState);          // comboBoxItem2 in the visible area
            Assert.Equal(comboBoxItem3.State, InvisibleItemState); // comboBoxItem3 below the visible area
        }
        public void ComboBoxItemAccessibleObject_DropDownCollapsed_State_ReturnExpected(ComboBoxStyle comboBoxStyle)
        {
            using ComboBox comboBox = GetComboBox(comboBoxStyle);

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);

            Assert.Equal(comboBoxItem1.State, InvisibleItemState);
            Assert.Equal(comboBoxItem2.State, InvisibleItemState);
        }
        public void ComboBoxItemAccessibleObject_DropDownHeight_State_ReturnExpected(ComboBoxStyle comboBoxStyle)
        {
            using ComboBox comboBox = GetComboBoxWithMaxHeight(comboBoxStyle);

            ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                  .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
            ComboBox.ComboBoxItemAccessibleObject comboBoxItem3 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem2
                                                                  .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);

            Assert.Equal(comboBoxItem1.State, InvisibleItemState); // comboBoxItem1 above the visible area
            Assert.Equal(comboBoxItem2.State, VisibleItemState);   // comboBoxItem2 in the visible area
            Assert.Equal(comboBoxItem3.State, InvisibleItemState); // comboBoxItem3 below the visible area
        }
예제 #7
0
        public void ComboBoxItemAccessibleObject_SeveralSameItems_FragmentNavigate_NextSibling_ReturnExpected()
        {
            using (new NoAssertContext())
            {
                using ComboBox comboBox = new ComboBox();
                comboBox.CreateControl();

                comboBox.Items.AddRange(new[] { "aaa", "aaa", "aaa" });
                ComboBox.ComboBoxItemAccessibleObject comboBoxItem1 = (ComboBox.ComboBoxItemAccessibleObject)comboBox
                                                                      .ChildListAccessibleObject.FragmentNavigate(Interop.UiaCore.NavigateDirection.FirstChild);
                Assert.Equal("aaa", comboBoxItem1.Name);

                // FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling) should return accessible object for second "aaa" item
                ComboBox.ComboBoxItemAccessibleObject comboBoxItem2 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem1
                                                                      .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
                Assert.NotEqual(comboBoxItem1, comboBoxItem2);
                Assert.Equal("aaa", comboBoxItem2.Name);

                // FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling) should return accessible object for third "aaa" item
                ComboBox.ComboBoxItemAccessibleObject comboBoxItem3 = (ComboBox.ComboBoxItemAccessibleObject)comboBoxItem2
                                                                      .FragmentNavigate(Interop.UiaCore.NavigateDirection.NextSibling);
                Assert.NotEqual(comboBoxItem3, comboBoxItem2);
                Assert.NotEqual(comboBoxItem3, comboBoxItem1);
                Assert.Equal("aaa", comboBoxItem3.Name);

                Assert.True(comboBox.IsHandleCreated);
            }
        }