System\Windows\Forms\Accessibility\AccessibleRoleControlTypeMap.cs (68)
13private static readonly Dictionary<AccessibleRole, UIA_CONTROLTYPE_ID> s_map = new()
15{ AccessibleRole.Alert, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
16{ AccessibleRole.Animation, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
17{ AccessibleRole.Application, UIA_CONTROLTYPE_ID.UIA_WindowControlTypeId },
18{ AccessibleRole.Border, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
19{ AccessibleRole.ButtonDropDown, UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId },
20{ AccessibleRole.ButtonDropDownGrid, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId },
21{ AccessibleRole.ButtonMenu, UIA_CONTROLTYPE_ID.UIA_MenuItemControlTypeId },
22{ AccessibleRole.Caret, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
23{ AccessibleRole.Cell, UIA_CONTROLTYPE_ID.UIA_DataItemControlTypeId },
24{ AccessibleRole.Character, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
25{ AccessibleRole.Chart, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
26{ AccessibleRole.CheckButton, UIA_CONTROLTYPE_ID.UIA_CheckBoxControlTypeId },
27{ AccessibleRole.Client, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
28{ AccessibleRole.Clock, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId },
29{ AccessibleRole.Column, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
30{ AccessibleRole.ColumnHeader, UIA_CONTROLTYPE_ID.UIA_HeaderControlTypeId },
31{ AccessibleRole.ComboBox, UIA_CONTROLTYPE_ID.UIA_ComboBoxControlTypeId },
32{ AccessibleRole.Cursor, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
33{ AccessibleRole.Default, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
34{ AccessibleRole.Diagram, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
35{ AccessibleRole.Dial, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
36{ AccessibleRole.Dialog, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
37{ AccessibleRole.Document, UIA_CONTROLTYPE_ID.UIA_DocumentControlTypeId },
38{ AccessibleRole.DropList, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
39{ AccessibleRole.Equation, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
40{ AccessibleRole.Graphic, UIA_CONTROLTYPE_ID.UIA_ImageControlTypeId },
41{ AccessibleRole.Grip, UIA_CONTROLTYPE_ID.UIA_ThumbControlTypeId },
42{ AccessibleRole.Grouping, UIA_CONTROLTYPE_ID.UIA_GroupControlTypeId },
43{ AccessibleRole.HelpBalloon, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
44{ AccessibleRole.HotkeyField, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
45{ AccessibleRole.Indicator, UIA_CONTROLTYPE_ID.UIA_ThumbControlTypeId },
46{ AccessibleRole.IpAddress, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
47{ AccessibleRole.Link, UIA_CONTROLTYPE_ID.UIA_HyperlinkControlTypeId },
48{ AccessibleRole.List, UIA_CONTROLTYPE_ID.UIA_ListControlTypeId },
49{ AccessibleRole.ListItem, UIA_CONTROLTYPE_ID.UIA_ListItemControlTypeId },
50{ AccessibleRole.MenuBar, UIA_CONTROLTYPE_ID.UIA_MenuBarControlTypeId },
51{ AccessibleRole.MenuItem, UIA_CONTROLTYPE_ID.UIA_MenuItemControlTypeId },
52{ AccessibleRole.MenuPopup, UIA_CONTROLTYPE_ID.UIA_MenuControlTypeId },
53{ AccessibleRole.None, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
54{ AccessibleRole.Outline, UIA_CONTROLTYPE_ID.UIA_TreeControlTypeId },
55{ AccessibleRole.OutlineButton, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
56{ AccessibleRole.OutlineItem, UIA_CONTROLTYPE_ID.UIA_TreeItemControlTypeId },
57{ AccessibleRole.PageTab, UIA_CONTROLTYPE_ID.UIA_TabItemControlTypeId },
58{ AccessibleRole.PageTabList, UIA_CONTROLTYPE_ID.UIA_TabControlTypeId },
59{ AccessibleRole.Pane, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
60{ AccessibleRole.ProgressBar, UIA_CONTROLTYPE_ID.UIA_ProgressBarControlTypeId },
61{ AccessibleRole.PropertyPage, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
62{ AccessibleRole.PushButton, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId },
63{ AccessibleRole.RadioButton, UIA_CONTROLTYPE_ID.UIA_RadioButtonControlTypeId },
64{ AccessibleRole.Row, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
65{ AccessibleRole.RowHeader, UIA_CONTROLTYPE_ID.UIA_HeaderControlTypeId },
66{ AccessibleRole.ScrollBar, UIA_CONTROLTYPE_ID.UIA_ScrollBarControlTypeId },
67{ AccessibleRole.Separator, UIA_CONTROLTYPE_ID.UIA_SeparatorControlTypeId },
68{ AccessibleRole.Slider, UIA_CONTROLTYPE_ID.UIA_SliderControlTypeId },
69{ AccessibleRole.Sound, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
70{ AccessibleRole.SpinButton, UIA_CONTROLTYPE_ID.UIA_SpinnerControlTypeId },
71{ AccessibleRole.SplitButton, UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId },
72{ AccessibleRole.StaticText, UIA_CONTROLTYPE_ID.UIA_TextControlTypeId },
73{ AccessibleRole.StatusBar, UIA_CONTROLTYPE_ID.UIA_StatusBarControlTypeId },
74{ AccessibleRole.Table, UIA_CONTROLTYPE_ID.UIA_TableControlTypeId },
75{ AccessibleRole.Text, UIA_CONTROLTYPE_ID.UIA_EditControlTypeId },
76{ AccessibleRole.TitleBar, UIA_CONTROLTYPE_ID.UIA_TitleBarControlTypeId },
77{ AccessibleRole.ToolBar, UIA_CONTROLTYPE_ID.UIA_ToolBarControlTypeId },
78{ AccessibleRole.ToolTip, UIA_CONTROLTYPE_ID.UIA_ToolTipControlTypeId },
79{ AccessibleRole.WhiteSpace, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId },
80{ AccessibleRole.Window, UIA_CONTROLTYPE_ID.UIA_WindowControlTypeId }
83public static UIA_CONTROLTYPE_ID GetControlType(AccessibleRole role) => s_map[role];
System\Windows\Forms\AccessibleObjects\AccessibleObjectTests.cs (32)
28Assert.Equal(AccessibleRole.None, accessibleObject.Role);
623Assert.Equal(AccessibleRole.None, accessibleObject.Role);
642Assert.Equal(AccessibleRole.Client, accessibleObject.Role);
663Assert.Equal(AccessibleRole.Graphic, accessibleObject.Role);
689Assert.Equal(AccessibleRole.None, accessibleObject.Role);
708Assert.Equal(AccessibleRole.None, accessibleObject.Role);
727Assert.Equal(AccessibleRole.Window, accessibleObject.Role);
746Assert.Equal(AccessibleRole.Client, accessibleObject.Role);
767Assert.Equal(AccessibleRole.None, accessibleObject.Role);
788Assert.Equal(AccessibleRole.Graphic, accessibleObject.Role);
809Assert.Equal(AccessibleRole.Window, accessibleObject.Role);
2134[InlineData(AccessibleRole.None, 0)]
2135[InlineData(AccessibleRole.None, unchecked((int)0x80020004))]
2136[InlineData(AccessibleRole.None, "abc")]
2137[InlineData(AccessibleRole.None, null)]
2138[InlineData(AccessibleRole.Default, 0)]
2139[InlineData(AccessibleRole.Default, unchecked((int)0x80020004))]
2140[InlineData(AccessibleRole.Default, "abc")]
2141[InlineData(AccessibleRole.Default, null)]
2142[InlineData(AccessibleRole.Sound, 0)]
2143[InlineData(AccessibleRole.Sound, unchecked((int)0x80020004))]
2144[InlineData(AccessibleRole.Sound, "abc")]
2145[InlineData(AccessibleRole.Sound, null)]
2146public void AccessibleObject_IAccessibleGet_accRole_InvokeDefaultSelf_ReturnsExpected(AccessibleRole result, object varChild)
2167Assert.Equal((int)AccessibleRole.Window, iAccessible.get_accRole((int)PInvoke.CHILDID_SELF));
2172[InlineData(AccessibleRole.None, 2, 1, 0)]
2173[InlineData(AccessibleRole.Default, 2, 1, 0)]
2174[InlineData(AccessibleRole.Sound, 2, 1, 0)]
2175[InlineData(AccessibleRole.None, 3, 0, 1)]
2176[InlineData(AccessibleRole.Default, 3, 0, 1)]
2177[InlineData(AccessibleRole.Sound, 3, 0, 1)]
2178public void AccessibleObject_IAccessibleGet_accRole_InvokeDefaultChild_ReturnsExpected(AccessibleRole result, object varChild, int child1CallCount, int child2CallCount)
System\Windows\Forms\AccessibleObjects\ButtonBase.ButtonBaseAccessibleObjectTests.cs (15)
67[InlineData(true, true, AccessibleRole.Client)]
68[InlineData(true, false, AccessibleRole.HelpBalloon)]
69[InlineData(false, true, AccessibleRole.None)]
70[InlineData(false, false, AccessibleRole.HelpBalloon)]
71public void ButtonBase_CreateAccessibilityInstance_InvokeWithRole_ReturnsExpected(bool createControl, bool defaultRole, AccessibleRole expectedAccessibleRole)
77control.AccessibleRole = AccessibleRole.HelpBalloon;
107Assert.Equal(AccessibleRole.Client, instance.Role);
123Assert.Equal(AccessibleRole.None, instance.Role);
187[InlineData(true, AccessibleRole.Client)]
188[InlineData(false, AccessibleRole.None)]
189public void ButtonBaseBoxAccessibleObject_ControlType_IsPane_IfAccessibleRoleIsDefault(bool createControl, AccessibleRole expectedRole)
209Array roles = Enum.GetValues(typeof(AccessibleRole));
211foreach (AccessibleRole role in roles)
213if (role == AccessibleRole.Default)
224public void ButtonBaseAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
System\Windows\Forms\AccessibleRoleControlTypeMapTests.cs (72)
12Array roles = Enum.GetValues(typeof(AccessibleRole));
14foreach (AccessibleRole role in roles)
22public void AccessibleRoleControlTypeMap_Contains_AllRoles(AccessibleRole role)
34AccessibleRole incorrectRole = (AccessibleRole)(-999);
41yield return new object[] { AccessibleRole.Alert, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
42yield return new object[] { AccessibleRole.Animation, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
43yield return new object[] { AccessibleRole.Application, UIA_CONTROLTYPE_ID.UIA_WindowControlTypeId };
44yield return new object[] { AccessibleRole.Border, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
45yield return new object[] { AccessibleRole.ButtonDropDown, UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId };
46yield return new object[] { AccessibleRole.ButtonDropDownGrid, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId };
47yield return new object[] { AccessibleRole.ButtonMenu, UIA_CONTROLTYPE_ID.UIA_MenuItemControlTypeId };
48yield return new object[] { AccessibleRole.Caret, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
49yield return new object[] { AccessibleRole.Cell, UIA_CONTROLTYPE_ID.UIA_DataItemControlTypeId };
50yield return new object[] { AccessibleRole.Character, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
51yield return new object[] { AccessibleRole.Chart, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
52yield return new object[] { AccessibleRole.CheckButton, UIA_CONTROLTYPE_ID.UIA_CheckBoxControlTypeId };
53yield return new object[] { AccessibleRole.Client, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
54yield return new object[] { AccessibleRole.Clock, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId };
55yield return new object[] { AccessibleRole.Column, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
56yield return new object[] { AccessibleRole.ColumnHeader, UIA_CONTROLTYPE_ID.UIA_HeaderControlTypeId };
57yield return new object[] { AccessibleRole.ComboBox, UIA_CONTROLTYPE_ID.UIA_ComboBoxControlTypeId };
58yield return new object[] { AccessibleRole.Cursor, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
59yield return new object[] { AccessibleRole.Default, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
60yield return new object[] { AccessibleRole.Diagram, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
61yield return new object[] { AccessibleRole.Dial, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
62yield return new object[] { AccessibleRole.Dialog, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
63yield return new object[] { AccessibleRole.Document, UIA_CONTROLTYPE_ID.UIA_DocumentControlTypeId };
64yield return new object[] { AccessibleRole.DropList, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
65yield return new object[] { AccessibleRole.Equation, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
66yield return new object[] { AccessibleRole.Graphic, UIA_CONTROLTYPE_ID.UIA_ImageControlTypeId };
67yield return new object[] { AccessibleRole.Grip, UIA_CONTROLTYPE_ID.UIA_ThumbControlTypeId };
68yield return new object[] { AccessibleRole.Grouping, UIA_CONTROLTYPE_ID.UIA_GroupControlTypeId };
69yield return new object[] { AccessibleRole.HelpBalloon, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
70yield return new object[] { AccessibleRole.HotkeyField, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
71yield return new object[] { AccessibleRole.Indicator, UIA_CONTROLTYPE_ID.UIA_ThumbControlTypeId };
72yield return new object[] { AccessibleRole.IpAddress, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
73yield return new object[] { AccessibleRole.Link, UIA_CONTROLTYPE_ID.UIA_HyperlinkControlTypeId };
74yield return new object[] { AccessibleRole.List, UIA_CONTROLTYPE_ID.UIA_ListControlTypeId };
75yield return new object[] { AccessibleRole.ListItem, UIA_CONTROLTYPE_ID.UIA_ListItemControlTypeId };
76yield return new object[] { AccessibleRole.MenuBar, UIA_CONTROLTYPE_ID.UIA_MenuBarControlTypeId };
77yield return new object[] { AccessibleRole.MenuItem, UIA_CONTROLTYPE_ID.UIA_MenuItemControlTypeId };
78yield return new object[] { AccessibleRole.MenuPopup, UIA_CONTROLTYPE_ID.UIA_MenuControlTypeId };
79yield return new object[] { AccessibleRole.None, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
80yield return new object[] { AccessibleRole.Outline, UIA_CONTROLTYPE_ID.UIA_TreeControlTypeId };
81yield return new object[] { AccessibleRole.OutlineButton, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
82yield return new object[] { AccessibleRole.OutlineItem, UIA_CONTROLTYPE_ID.UIA_TreeItemControlTypeId };
83yield return new object[] { AccessibleRole.PageTab, UIA_CONTROLTYPE_ID.UIA_TabItemControlTypeId };
84yield return new object[] { AccessibleRole.PageTabList, UIA_CONTROLTYPE_ID.UIA_TabControlTypeId };
85yield return new object[] { AccessibleRole.Pane, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
86yield return new object[] { AccessibleRole.ProgressBar, UIA_CONTROLTYPE_ID.UIA_ProgressBarControlTypeId };
87yield return new object[] { AccessibleRole.PropertyPage, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
88yield return new object[] { AccessibleRole.PushButton, UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId };
89yield return new object[] { AccessibleRole.RadioButton, UIA_CONTROLTYPE_ID.UIA_RadioButtonControlTypeId };
90yield return new object[] { AccessibleRole.Row, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
91yield return new object[] { AccessibleRole.RowHeader, UIA_CONTROLTYPE_ID.UIA_HeaderControlTypeId };
92yield return new object[] { AccessibleRole.ScrollBar, UIA_CONTROLTYPE_ID.UIA_ScrollBarControlTypeId };
93yield return new object[] { AccessibleRole.Separator, UIA_CONTROLTYPE_ID.UIA_SeparatorControlTypeId };
94yield return new object[] { AccessibleRole.Slider, UIA_CONTROLTYPE_ID.UIA_SliderControlTypeId };
95yield return new object[] { AccessibleRole.Sound, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
96yield return new object[] { AccessibleRole.SpinButton, UIA_CONTROLTYPE_ID.UIA_SpinnerControlTypeId };
97yield return new object[] { AccessibleRole.SplitButton, UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId };
98yield return new object[] { AccessibleRole.StaticText, UIA_CONTROLTYPE_ID.UIA_TextControlTypeId };
99yield return new object[] { AccessibleRole.StatusBar, UIA_CONTROLTYPE_ID.UIA_StatusBarControlTypeId };
100yield return new object[] { AccessibleRole.Table, UIA_CONTROLTYPE_ID.UIA_TableControlTypeId };
101yield return new object[] { AccessibleRole.Text, UIA_CONTROLTYPE_ID.UIA_EditControlTypeId };
102yield return new object[] { AccessibleRole.TitleBar, UIA_CONTROLTYPE_ID.UIA_TitleBarControlTypeId };
103yield return new object[] { AccessibleRole.ToolBar, UIA_CONTROLTYPE_ID.UIA_ToolBarControlTypeId };
104yield return new object[] { AccessibleRole.ToolTip, UIA_CONTROLTYPE_ID.UIA_ToolTipControlTypeId };
105yield return new object[] { AccessibleRole.WhiteSpace, UIA_CONTROLTYPE_ID.UIA_PaneControlTypeId };
106yield return new object[] { AccessibleRole.Window, UIA_CONTROLTYPE_ID.UIA_WindowControlTypeId };
111public void AccessibleRoleControlTypeMap_GetControlType_ReturnsExpectedValue(AccessibleRole role, int expectedType)
System\Windows\Forms\ButtonTests.cs (16)
25Assert.Equal(AccessibleRole.Default, control.AccessibleRole);
1009Assert.Equal(AccessibleRole.None, instance.Role);
1030Assert.Equal(AccessibleRole.PushButton, instance.Role);
1037[InlineData(true, FlatStyle.Flat, AccessibleStates.Pressed | AccessibleStates.Focusable, AccessibleRole.PushButton)]
1038[InlineData(true, FlatStyle.Popup, AccessibleStates.Pressed | AccessibleStates.Focusable, AccessibleRole.PushButton)]
1039[InlineData(true, FlatStyle.Standard, AccessibleStates.Pressed | AccessibleStates.Focusable, AccessibleRole.PushButton)]
1040[InlineData(true, FlatStyle.System, AccessibleStates.Focusable, AccessibleRole.PushButton)]
1041[InlineData(false, FlatStyle.Flat, AccessibleStates.None, AccessibleRole.None)]
1042[InlineData(false, FlatStyle.Popup, AccessibleStates.None, AccessibleRole.None)]
1043[InlineData(false, FlatStyle.Standard, AccessibleStates.None, AccessibleRole.None)]
1044[InlineData(false, FlatStyle.System, AccessibleStates.None, AccessibleRole.None)]
1045public void Button_CreateAccessibilityInstance_InvokeMouseDown_ReturnsExpected(bool createControl, FlatStyle flatStyle, AccessibleStates expectedState, AccessibleRole expectedRole)
1077AccessibleRole = AccessibleRole.HelpBalloon
1086Assert.Equal(AccessibleRole.HelpBalloon, instance.Role);
1099AccessibleRole = AccessibleRole.HelpBalloon
1107Assert.Equal(AccessibleRole.HelpBalloon, instance.Role);
System\Windows\Forms\ToolStripButtonTests.cs (12)
23Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
104Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
191Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
281Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
370Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
468Assert.Equal(AccessibleRole.Default, item.AccessibleRole);
1004Assert.Equal(AccessibleRole.PushButton, accessibleObject.Role);
1015AccessibleRole = AccessibleRole.HelpBalloon
1018Assert.Equal(AccessibleRole.HelpBalloon, accessibleObject.Role);
1032Assert.Equal(AccessibleRole.CheckButton, accessibleObject.Role);
1051Assert.Equal(AccessibleRole.CheckButton, accessibleObject.Role);
1070Assert.Equal(AccessibleRole.PushButton, accessibleObject.Role);