public void DropDownHolder_AccessibilityObject_Constructor_initializes_correctly()
        {
            using PropertyGridView propertyGridView = new PropertyGridView(null, null);
            propertyGridView.BackColor = Color.Green;
            using PropertyGridView.DropDownHolder dropDownHolder = new PropertyGridView.DropDownHolder(propertyGridView);

            Assert.Equal(Color.Green, dropDownHolder.BackColor);
        }
        public void DropDownHolder_CreateAccessibilityObject_creates_DropDownHolderAccessibleObject()
        {
            using PropertyGrid propertyGrid = new PropertyGrid();
            PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView;

            using PropertyGridView.DropDownHolder dropDownHolder = new PropertyGridView.DropDownHolder(propertyGridView);

            AccessibleObject accessibleObject = dropDownHolder.AccessibilityObject;

            Assert.Equal("DropDownHolderAccessibleObject", accessibleObject.GetType().Name);
        }
Beispiel #3
0
        public void DropDownHolderAccessibleObject_ControlType_IsPane_IfAccessibleRoleIsDefault()
        {
            using PropertyGrid propertyGrid = new PropertyGrid();
            PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView;

            using PropertyGridView.DropDownHolder dropDownControlHolder = new PropertyGridView.DropDownHolder(propertyGridView);
            // AccessibleRole is not set = Default

            object actual = dropDownControlHolder.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            Assert.Equal(UiaCore.UIA.PaneControlTypeId, actual);
            Assert.False(propertyGrid.IsHandleCreated);
            Assert.False(dropDownControlHolder.IsHandleCreated);
        }
Beispiel #4
0
        public void DropDownHolder_AccessibilityObject_Constructor_initializes_fields()
        {
            using PropertyGrid propertyGrid = new PropertyGrid();
            PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView;

            using PropertyGridView.DropDownHolder dropDownHolderControl = new PropertyGridView.DropDownHolder(propertyGridView);
            PropertyGridView.DropDownHolder.DropDownHolderAccessibleObject dropDownHolderControlAccessibilityObject =
                Assert.IsAssignableFrom <PropertyGridView.DropDownHolder.DropDownHolderAccessibleObject>(
                    dropDownHolderControl.AccessibilityObject);

            PropertyGridView.DropDownHolder dropDownHolder =
                dropDownHolderControlAccessibilityObject.TestAccessor().Dynamic._owningDropDownHolder;
            Assert.NotNull(dropDownHolder);
            Assert.Same(dropDownHolder, dropDownHolderControl);
        }
Beispiel #5
0
        public void DropDownHolder_AccessibilityObject_ReturnsExpected()
        {
            using PropertyGrid propertyGrid = new PropertyGrid();
            PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView;

            using PropertyGridView.DropDownHolder ownerControl = new PropertyGridView.DropDownHolder(propertyGridView);
            Control.ControlAccessibleObject accessibilityObject = ownerControl.AccessibilityObject as Control.ControlAccessibleObject;

            Assert.NotNull(accessibilityObject.Owner);
            Assert.Equal(ownerControl, accessibilityObject.Owner);

            Assert.Equal(SR.PropertyGridViewDropDownControlHolderAccessibleName,
                         accessibilityObject.GetPropertyValue(UiaCore.UIA.NamePropertyId));

            AccessibleObject selectedGridEntryAccessibleObject = null;

            Assert.Equal(selectedGridEntryAccessibleObject, accessibilityObject.FragmentNavigate(UiaCore.NavigateDirection.Parent));

            PropertyDescriptor          property  = TypeDescriptor.GetProperties(typeof(PropertyGrid))[0];
            PropertyDescriptorGridEntry gridEntry = new PropertyDescriptorGridEntry(propertyGrid, null, property, false);

            propertyGridView.TestAccessor().Dynamic._selectedGridEntry = gridEntry;

            ownerControl.Visible = true;

            selectedGridEntryAccessibleObject = gridEntry.AccessibilityObject;
            Assert.Equal(selectedGridEntryAccessibleObject, accessibilityObject.FragmentNavigate(UiaCore.NavigateDirection.Parent));

            AccessibleObject editAccessibleObject = propertyGridView.EditAccessibleObject;

            Assert.Equal(editAccessibleObject, accessibilityObject.FragmentNavigate(UiaCore.NavigateDirection.NextSibling));

            Assert.Null(accessibilityObject.FragmentNavigate(UiaCore.NavigateDirection.PreviousSibling));

            Assert.Equal(propertyGrid.AccessibilityObject, accessibilityObject.FragmentRoot);
        }
 public void DropDownHolder_SupportsUiaProviders_returns_true()
 {
     using PropertyGridView propertyGridView = new PropertyGridView(null, null);
     using PropertyGridView.DropDownHolder dropDownHolder = new PropertyGridView.DropDownHolder(propertyGridView);
     Assert.True(dropDownHolder.SupportsUiaProviders);
 }