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 issue with announcing of PropertyGrid expanded state #7242

Conversation

dkazennov
Copy link
Contributor

@dkazennov dkazennov commented May 31, 2022

Fixes #6656
Finishes PR #6737

Proposed changes

  • The problem is being reproduced due to competitive requests to Narrator. Periodically it announces expanded state information and periodically skips.
  • A possible fix is to replace the standard method RaiseAutomationPropertyChangedEvent with the InternalRaiseAutomationNotification (RaiseAutomationNotification) method. In this case, we force the expanded state information to be announced, which helps avoid a possible contention problem.
  • Unit test PropertyGridView_GridEntry_AccessibleObject_GetsNotification

Customer Impact

Before

image

After

image

Regression?

  • Yes (we have unstable behavior)

Risk

  • Minimal

Test methodology

  • CTI team
  • Manually
  • Unit test

Accessibility testing

  • Narrator
  • JAWS
  • NVDA

Test environment(s)

Microsoft Windows [Version 120.2212.4170.0]
.NET Core SDK: 7.0.100-preview.3.22179.4

Microsoft Reviewers: Open in CodeFlow

@dkazennov dkazennov requested a review from a team as a code owner May 31, 2022 17:55
@ghost ghost assigned dkazennov May 31, 2022
@dkazennov dkazennov added the draft draft PR label May 31, 2022
@ghost ghost removed the draft draft PR label May 31, 2022
@dreddy-work dreddy-work marked this pull request as draft May 31, 2022 20:45
@ghost ghost added the draft draft PR label Jun 1, 2022
@dkazennov dkazennov force-pushed the Issue_6656_Announcing_PG_Expanded_State branch from 917e39e to 5b5df9f Compare June 1, 2022 10:29
@dkazennov dkazennov force-pushed the Issue_6656_Announcing_PG_Expanded_State branch 3 times, most recently from 890a171 to 1c3e2e6 Compare June 7, 2022 09:26
@dkazennov dkazennov added waiting-review This item is waiting on review by one or more members of team tenet-accessibility MAS violation, UIA issue; problems with accessibility standards and removed draft draft PR labels Jun 7, 2022
@dkazennov
Copy link
Contributor Author

dkazennov commented Jun 7, 2022

New unit test works as expected. There are some unstable tests here though.

@dkazennov dkazennov force-pushed the Issue_6656_Announcing_PG_Expanded_State branch from 1c3e2e6 to 30dccba Compare June 7, 2022 10:42
@ghost ghost added the draft draft PR label Jun 7, 2022
@dkazennov dkazennov removed the draft draft PR label Jun 8, 2022
@dkazennov dkazennov marked this pull request as ready for review June 8, 2022 13:09
Copy link
Contributor

@dmitrii-drobotov dmitrii-drobotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few nits

Comment on lines 96 to 99
public System.Drawing.Size SizeProperty
{
get; set;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public System.Drawing.Size SizeProperty
{
get; set;
}
public System.Drawing.Size SizeProperty { get; set; }


private class TestGridEntry : GridEntry
{
readonly PropertyGridView _propertyGridView;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
readonly PropertyGridView _propertyGridView;
private readonly PropertyGridView _propertyGridView;

{
readonly PropertyGridView _propertyGridView;

public TestGridEntry(PropertyGrid ownerGrid, GridEntry peParent, PropertyGridView propertyGridView)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public TestGridEntry(PropertyGrid ownerGrid, GridEntry peParent, PropertyGridView propertyGridView)
public TestGridEntry(PropertyGrid ownerGrid, GridEntry parent, PropertyGridView propertyGridView)

propertyGridView.DropDownControl(new Control());

Assert.Equal(1, accessibleObject.RaiseAutomationNotificationCallCount);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is still missing IsHandleCreated checks, as @vladimir-krestov suggested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is still missing IsHandleCreated checks, as @vladimir-krestov suggested.

The test creates Handles for controls so Assert.False(IsHandleCreated) fails the test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do Assert.True(IsHandleCreated) in that case


public int RaiseAutomationNotificationCallCount { get; set; }

internal override bool InternalRaiseAutomationNotification(AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string notificationText)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
internal override bool InternalRaiseAutomationNotification(AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string notificationText)
internal override bool InternalRaiseAutomationNotification(AutomationNotificationKind notificationKind,
AutomationNotificationProcessing notificationProcessing, string notificationText)

{
}

public int RaiseAutomationNotificationCallCount { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public int RaiseAutomationNotificationCallCount { get; set; }
public int RaiseAutomationNotificationCallCount { get; private set; }

@dkazennov dkazennov force-pushed the Issue_6656_Announcing_PG_Expanded_State branch 2 times, most recently from 1d96540 to 7978cb6 Compare June 14, 2022 16:44
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines 99 to 100
public System.Drawing.Size SizeProperty
{ get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public System.Drawing.Size SizeProperty
{ get; set; }
public System.Drawing.Size SizeProperty { get; set; }

@vladimir-krestov
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@vladimir-krestov vladimir-krestov added the 📬 waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jun 23, 2022
Copy link
Contributor

@vladimir-krestov vladimir-krestov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Please send it to CTI

@dkazennov
Copy link
Contributor Author

CTI Testing requested.

@dkazennov
Copy link
Contributor Author

CTI test passed successfully. Let's rerun Pipeline tests.

@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented Jul 20, 2022

@dkazennov - looks like Vladimir can re-run tests, please ask him to get a faster turnaround. Or message in teams. I missed this request.

@Tanya-Solyanik
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@vladimir-krestov
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Tanya-Solyanik
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Assert.True(propertyGridView.IsAccessibilityObjectCreated);
Assert.Equal(testGridEntry, selectedGridEntry);
Assert.Equal(testGridEntry, gridEntries[selectedRow]);
propertyGridView.DropDownControl(new Control());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Control that you new-up is not Disposed

Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that your test is crashing the test process. Does it pass in the VS? Does it pass from the command line? Had you tried running it individually -

dotnet test --filter <filter expression> command by switching to the desired test project directory first.

per https://github.com/dotnet/winforms/blob/main/docs/testing.md#adding-new-unit-tests


using Button button = new();
propertyGrid.SelectedObject = button;
GridEntryCollection gridEntries = propertyGridView.TestAccessor().Dynamic._allGridEntries;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look up if property grid view is re-created when selection object is set. If this is the case, please split this test into several, each dedicated to a specific selection.

@dkazennov
Copy link
Contributor Author

dkazennov commented Jul 28, 2022

@Tanya-Solyanik so we concluded to drop off the unit test since it is unstable and there is almost no test coverage for announcements.

…o Narrator. Periodically it announces expanded state information and periodically skips.

A possible fix is to replace the standard method "RaiseAutomationPropertyChangedEvent" with the "RaiseAutomationNotification" method. In this case, we force the expanded state information to be announced, which helps avoid a possible contention problem.
@Tanya-Solyanik Tanya-Solyanik merged commit d40b19d into dotnet:main Aug 1, 2022
@ghost ghost added this to the 7.0 RC1 milestone Aug 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 1, 2022
@RussKie RussKie removed the waiting-review This item is waiting on review by one or more members of team label Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📬 waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) tenet-accessibility MAS violation, UIA issue; problems with accessibility standards
Projects
None yet
6 participants