コード例 #1
0
        public void ToolStripLabelAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripLabel toolStripLabel = new ToolStripLabel();
            toolStripLabel.AccessibleRole       = role;

            Assert.Equal(AccessibleRoleControlTypeMap.GetControlType(role), toolStripLabel.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId));
            Assert.Null(toolStripLabel.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ValueValuePropertyId));
        }
コード例 #2
0
        public void AccessibleRoleControlTypeMap_Contains_AllRoles(AccessibleRole role)
        {
            // Check if the map contains the role
            // If so the map returns an exist UIA_ControlTypeId
            UIA actual = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.True(actual >= UIA.ButtonControlTypeId && actual <= UIA.AppBarControlTypeId);
        }
コード例 #3
0
        public void AccessibleRoleControlTypeMap_GetControlType_ReturnsExpectedValue(AccessibleRole role, int expectedType)
        {
            // UIA is less accessible than the test
            // so we have to use "int" type for "expectedType" argument
            UIA actual = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal((UIA)expectedType, actual);
        }
コード例 #4
0
        public void CheckBoxAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using CheckBox checkBox = new CheckBox();
            checkBox.AccessibleRole = role;
            UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, checkBox.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId));
            Assert.Equal(checkBox.AccessibilityObject.DefaultAction, checkBox.AccessibilityObject.GetPropertyValue(UIA.LegacyIAccessibleDefaultActionPropertyId));
            Assert.False(checkBox.IsHandleCreated);
        }
        public void SplitContainerAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using SplitContainer splitContainer = new();
            splitContainer.AccessibleRole       = role;

            object actual   = splitContainer.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId);
            UIA    expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(splitContainer.IsHandleCreated);
        }
コード例 #6
0
        public void DomainUpDownAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using DomainUpDown domainUpDown = new DomainUpDown();
            domainUpDown.AccessibleRole = role;

            object actual = domainUpDown.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);
            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(domainUpDown.IsHandleCreated);
        }
コード例 #7
0
        public void ListBoxAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ListBox listBox = new ListBox();
            listBox.AccessibleRole = role;

            object actual = listBox.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);
            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(listBox.IsHandleCreated);
        }
コード例 #8
0
        public void ToolStripButtonAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripButton toolStripButton = new ToolStripButton();
            toolStripButton.AccessibleRole        = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
        }
コード例 #9
0
        public void PanelAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using Panel panel    = new();
            panel.AccessibleRole = role;

            object actual   = panel.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId);
            UIA    expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(panel.IsHandleCreated);
        }
コード例 #10
0
        public void TabPageAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using TabPage tabPage  = new();
            tabPage.AccessibleRole = role;

            object actual   = tabPage.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId);
            UIA    expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(tabPage.IsHandleCreated);
        }
コード例 #11
0
        public void DataGridViewTextBoxEditingControlAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using DataGridViewTextBoxEditingControl textCellControl = new DataGridViewTextBoxEditingControl();
            textCellControl.AccessibleRole = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(textCellControl.IsHandleCreated);
        }
コード例 #12
0
        public void MenuStripAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using MenuStrip menuStrip = new MenuStrip();
            menuStrip.AccessibleRole  = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(menuStrip.IsHandleCreated);
        }
コード例 #13
0
        public void TextBoxBaseAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using TextBoxBase textBoxBase = new SubTextBoxBase();
            textBoxBase.AccessibleRole    = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(textBoxBase.IsHandleCreated);
        }
        public void PropertyGridAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using PropertyGrid propertyGrid = new PropertyGrid();
            propertyGrid.AccessibleRole     = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(propertyGrid.IsHandleCreated);
        }
コード例 #15
0
        public void FormAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using Form form     = new Form();
            form.AccessibleRole = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(form.IsHandleCreated);
        }
コード例 #16
0
        public void ToolStripItemAccessibleObject_GetPropertyValue_ControlTypeProperty_ReturnsCorrectValue(AccessibleRole role)
        {
            using ToolStripItem toolStripItem = new SubToolStripItem();
            toolStripItem.AccessibleRole      = role;

            UIA actual   = (UIA)toolStripItem.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId);
            UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            // Check if the method returns an exist UIA_ControlTypeId
            Assert.True(actual >= UIA.ButtonControlTypeId && actual <= UIA.AppBarControlTypeId);
        }
コード例 #17
0
        public void MonthCalendarAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using MonthCalendar monthCalendar = new MonthCalendar();
            monthCalendar.AccessibleRole      = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(monthCalendar.IsHandleCreated);
        }
コード例 #18
0
        public void ButtonAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using Button button   = new Button();
            button.AccessibleRole = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(button.IsHandleCreated);
        }
        public void TableLayoutPanelAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
            tableLayoutPanel.AccessibleRole         = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(tableLayoutPanel.IsHandleCreated);
        }
コード例 #20
0
        public void DateTimePickerAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using DateTimePicker dateTimePicker = new();
            dateTimePicker.AccessibleRole       = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(dateTimePicker.IsHandleCreated);
        }
        public void UpDownEditAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using UpDownBase upDown = new SubUpDownBase();
            using UpDownBase.UpDownEdit upDownEdit = new UpDownBase.UpDownEdit(upDown);
            upDownEdit.AccessibleRole = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(upDownEdit.IsHandleCreated);
        }
        public void ToolStripProgressBarControlAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripProgressBarControl toolStripProgressBarControl = new ToolStripProgressBarControl();
            toolStripProgressBarControl.AccessibleRole = role;

            AccessibleObject accessibleObject = toolStripProgressBarControl.AccessibilityObject;
            object           actual           = accessibleObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(role, accessibleObject.Role);
            Assert.Equal(expected, actual);
            Assert.False(toolStripProgressBarControl.IsHandleCreated);
        }
        public void DataGridViewEditingPanelAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using DataGridView dataGridView = new DataGridView();
            Panel editingPanel = dataGridView.EditingPanel;

            editingPanel.AccessibleRole = role;

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

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
            Assert.False(editingPanel.IsHandleCreated);
        }
        public void ToolStripComboBoxControlAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripComboBox toolStripComboBox = new ToolStripComboBox();
            toolStripComboBox.AccessibleRole          = role;
            ToolStripComboBoxControl control = (ToolStripComboBoxControl)toolStripComboBox.ComboBox;

            control.CreateControl();

            AccessibleObject accessibleObject = toolStripComboBox.AccessibilityObject;
            object           actual           = accessibleObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            Assert.Equal(role, accessibleObject.Role);
            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);
            Assert.Equal(expected, actual);
        }
コード例 #25
0
        public void ToolStripOverflowAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripButton toolStripItem       = new ToolStripButton();
            using ToolStripOverflow toolStripOverflow = new ToolStripOverflow(toolStripItem);
            toolStripOverflow.AccessibleRole          = role;

            AccessibleObject accessibleObject = toolStripOverflow.AccessibilityObject;
            object           actual           = accessibleObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(role, accessibleObject.Role);
            Assert.Equal(expected, actual);
            Assert.False(toolStripOverflow.IsHandleCreated);
        }
コード例 #26
0
        public void AccessibleRoleControlTypeMap_GetControlType_ThrowsException_IfRoleArgumentIsIncorrect()
        {
            AccessibleRole incorrectRole = (AccessibleRole)(-999);

            Assert.Throws <KeyNotFoundException>(() => AccessibleRoleControlTypeMap.GetControlType(incorrectRole));
        }