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

Fix failing UIA movement tests #10991

Merged
2 commits merged into from
Aug 24, 2021
Merged

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Aug 19, 2021

Summary of the Pull Request

Follow-up for #10886. The new UIA movement tests found some failing cases. This PR fixes UiaTextRangeBase to have movement match that of MS Word. In total, this fixes 64 tests.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Root causes include...

  1. if we were a non-degenerate range and we failed to move, we should still expand to enclose the unit
  2. non-degenerate ranges are treated as if they already encompassed their given unit.
    • this one is a bit difficult to explain. Consider these examples:
      1. document movement
        • state: you have a 1-cell wide range on the buffer, and you try to move by document
        • result: move by 0 (there is no next/prev document), but the range now encompasses the entire document
      2. line movement
        • state: you have a 1-cell wide range on a line, and you try to move back by a line
        • result: you go to the previous line (not the beginning of this line)
    • conversely, a degenerate range successfully moves to the beginning/end of the current unit (i.e. document/line)
    • this (bizarre) behavior was confirmed using MS Word

As a bonus, occasionally, Narrator would get stuck when navigating by line. This issue now seems to be fixed.

Updates to existing tests

  • CanMoveByCharacter
    • can't move backward from (0, 0) --> misauthored, result should be one character wide.
    • can't move past the last column in the last row --> misauthored and already covered in generated tests
  • CanMoveByLine
    • can't move backward from top row --> misauthored, end should be on next line. Already covered by generated tests
    • can't move forward from bottom row --> misauthored, end should be on next line
    • can't move backward when part of the top row is in the range --> misauthored, should expand
    • can't move forward when part of the bottom row is in the range --> misauthored, degenerate range moves to end of buffer
  • MovementAtExclusiveEnd
    • populate the text buffer before we do a move by word operation
    • update to match the now fixed behavior

@ghost ghost added Area-Accessibility Issues related to accessibility Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Aug 19, 2021
@carlos-zamora

This comment has been minimized.

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Aug 24, 2021
@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 24, 2021
@ghost
Copy link

ghost commented Aug 24, 2021

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit c53fe1c into main Aug 24, 2021
@ghost ghost deleted the dev/cazamor/a11y-7000/fix-failing-tests branch August 24, 2021 13:56
DHowett pushed a commit that referenced this pull request Aug 25, 2021
## Summary of the Pull Request
Follow-up for #10886. The new UIA movement tests found some failing cases. This PR fixes UiaTextRangeBase to have movement match that of MS Word. In total, this fixes 64 tests.

## PR Checklist
* [X] Closes #10924
* [X] Tests added/passed

## Detailed Description of the Pull Request / Additional comments
Root causes include...
1. if we were a non-degenerate range and we failed to move, we should still expand to enclose the unit
2. non-degenerate ranges are treated as if they already encompassed their given unit.
   - this one is a bit difficult to explain. Consider these examples:
      1. document movement
         - state: you have a 1-cell wide range on the buffer, and you try to move by document
         - result: move by 0 (there is no next/prev document), but the range now encompasses the entire document
      2. line movement
         - state: you have a 1-cell wide range on a line, and you try to move back by a line
         - result: you go to the previous line (not the beginning of this line)
   - conversely, a degenerate range successfully moves to the beginning/end of the current unit (i.e. document/line)
   - this (bizarre) behavior was confirmed using MS Word

As a bonus, occasionally, Narrator would get stuck when navigating by line. This issue now seems to be fixed.

## Updates to existing tests
- `CanMoveByCharacter`
   - `can't move backward from (0, 0)` --> misauthored, result should be one character wide.
   - `can't move past the last column in the last row` --> misauthored and already covered in generated tests
- `CanMoveByLine`
   - `can't move backward from top row` --> misauthored, end should be on next line. Already covered by generated tests
   - `can't move forward from bottom row` --> misauthored, end should be on next line
   - `can't move backward when part of the top row is in the range` --> misauthored, should expand
   - `can't move forward when part of the bottom row is in the range` --> misauthored, degenerate range moves to end of buffer
- `MovementAtExclusiveEnd`
   - populate the text buffer _before_ we do a move by word operation
   - update to match the now fixed behavior
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.10.2383.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost ghost mentioned this pull request Aug 31, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.11.2421.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Accessibility Issues related to accessibility AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix failing UIA tests from #10886
3 participants