-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert UIA Enum to Cswin32 #10081
Convert UIA Enum to Cswin32 #10081
Conversation
|
||
namespace Windows.Win32.UI.Accessibility; | ||
|
||
internal enum UIA_CONTROLTYPE_ID : int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although Cswin32 has a defined UIA_CONTROLTYPE_ID
, it is defined as uint
, which causes Narrator to give incorrect announcements. This may be a consequence of having partially converted Cswin32 definitions. IRawElementProviderSimple
is the primary interface that relies on the UIA enum and this hasn't been converted. For now, we will add this version of UIA_CONTROLTYPE_ID
definition and revisit whether or not UIA_CONTROLTYPE_ID
being defined as a uint
enum in Cswin32 is a bug when we convert IRawElementProviderSimple
to Cswin32, which is the next step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these enums should be signed ints per docs and the idl file. This one is the easiest to test. We have to return tha documented type from GetPropertyValue methods becasue this is what the accessibility tools are expecting. We can't expect accessibility tools coded to be resilient and try to cast uint to int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added UIA_PATTERN_ID
and UIA_PROPERTY_ID
and made them int enums. I will follow up filing an issue with metadata to make all the enums signed ints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Once you have the issue, please reference it in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a pretty mechanical change. Did you use find/replace or regex to swap the consts out? |
I used find/replace whenever there were multiple of the same UIA type ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but some test data can be simplified a little by removing casts to an int. Look for (int)UIA_ pattern
|
||
namespace Windows.Win32.UI.Accessibility; | ||
|
||
internal enum UIA_CONTROLTYPE_ID : int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Once you have the issue, please reference it in this file.
[InlineData((int)UIA_PATTERN_ID.UIA_TogglePatternId)] | ||
[InlineData((int)UIA_PATTERN_ID.UIA_InvokePatternId)] | ||
[InlineData((int)UIA_PATTERN_ID.UIA_LegacyIAccessiblePatternId)] | ||
[InlineData((int)UIA_PATTERN_ID.UIA_ValuePatternId)] | ||
public void CheckedListBoxItemAccessibleObject_IsPatternSupported_ReturnsExpected(int patternId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we can use the new enum type instead of the int in the parameter type, (UIA_PATTERN_ID patternId). This will let us get rid of the casts in the inline data.
This comment is applicable to multiple tests in this PR.
? (int)UiaCore.UIA.ComboBoxControlTypeId | ||
: (int)UiaCore.UIA.DataItemControlTypeId; | ||
? (int)UIA_CONTROLTYPE_ID.UIA_ComboBoxControlTypeId | ||
: (int)UIA_CONTROLTYPE_ID.UIA_DataItemControlTypeId; | ||
|
||
yield return new object[] { displayStyle, cellIsEdited, expectedControlType }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data can return UIA_CONTROLTYPE_ID instead of an int too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge as is and follow up on the comments in another PR
Will follow up on these comments in the next PR |
Removes
UIA
enum in preparation for more changes relating to converting COM interfaces onAccessibleObject
.Microsoft Reviewers: Open in CodeFlow