Skip to content
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

Fixing bug of searching for heading level throwing exception #5003

Merged
merged 8 commits into from
Aug 17, 2021

Conversation

guimafelipe
Copy link
Member

@guimafelipe guimafelipe commented Aug 4, 2021

Fixes Issue #4935

Main PR

Description

The type of the heading level property declaration in UIAutomationClient in the class Schema.cs was using a different type of what it is in PresentationCore. When creating a property condition, the exception is thrown because the one type is no assignable by the other.

The fact is the the AutomationElement stores the value of the ID of the property, starting at 80050. So, when we create the condition, we can't convert AutomationHeadingLevel to HeadingLevel. To solve this, we created a converter in the Schema, to convert from HeadingLevel to AutomationHeadingLevel, and set in the schema the type of the property to AutomationHeadingLevel for the info. Also, in the PropertyCondition.cs, we convert back from AutomationHeadingLevel (that is what the developer inputs to the class) to HeadingLevel (that is what is actually stored in the AutomationElement).

Customer Impact

Regression

Testing

To test this fix, a sample app was created, declaring an element with a HeadingLevel. And another app, a console application, was created to get the proccess of the first app, and find the element with the given AutomationHeadingLevel.

Risk

@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Aug 4, 2021
@ghost ghost requested review from fabiant3, ryalanms and SamBent August 4, 2021 14:51
Felipe da Conceicao Guimaraes added 2 commits August 5, 2021 16:26
@guimafelipe guimafelipe marked this pull request as ready for review August 6, 2021 16:00
@guimafelipe guimafelipe requested a review from a team as a code owner August 6, 2021 16:00
@guimafelipe guimafelipe merged commit e75a31c into main Aug 17, 2021
@vishalmsft vishalmsft deleted the fixing.headinglevel.schema branch February 10, 2022 06:04
@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants