Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ internal override VARIANT GetPropertyValue(UIA_PROPERTY_ID propertyID) =>
// If we don't set a default role for the accessible object
// it will be retrieved from Windows.
// And we don't have a 100% guarantee it will be correct, hence set it ourselves.
// SplitButton control type requires ExpandCollapse pattern support.
UIA_PROPERTY_ID.UIA_ControlTypePropertyId when
_owningToolStripSplitButton.AccessibleRole == AccessibleRole.Default
=> (VARIANT)(int)UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId,
=> (VARIANT)(int)UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId,
_ => base.GetPropertyValue(propertyID)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public void ToolStripSplitButtonAccessibleObject_Ctor_Default()
}

[WinFormsFact]
public void ToolStripSplitButtonAccessibleObject_ControlType_IsButton_IfAccessibleRoleIsDefault()
public void ToolStripSplitButtonAccessibleObject_ControlType_IsSplitButton_IfAccessibleRoleIsDefault()
{
using ToolStripSplitButton toolStripSplitButton = new();
// AccessibleRole is not set = Default

var actual = (UIA_CONTROLTYPE_ID)(int)toolStripSplitButton.AccessibilityObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId);

Assert.Equal(UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId, actual);
Assert.Equal(UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId, actual);
}

[WinFormsFact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void ToolStripSplitButtonExAccessibleObject_ControlType_ReturnsExpected()

ToolStripSplitButtonExAccessibleObject accessibleObject = new(toolStripSplitButton);

Assert.Equal(UIA_CONTROLTYPE_ID.UIA_ButtonControlTypeId, (UIA_CONTROLTYPE_ID)(int)accessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId));
Assert.Equal(UIA_CONTROLTYPE_ID.UIA_SplitButtonControlTypeId, (UIA_CONTROLTYPE_ID)(int)accessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId));
}

[WinFormsFact]
Expand Down