Skip to content

Add unit tests for comment threads in Word via UIA - #20924

Open
LeonarddeR wants to merge 3 commits into
nvaccess:betafrom
LeonarddeR:wordCommentTests
Open

LeonarddeR wants to merge 3 commits into
nvaccess:betafrom
LeonarddeR:wordCommentTests

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Follow-up of #20894

Summary of the issue:

#20894 changed how NVDA reads comment threads in Microsoft Word via UI Automation. It was merged without unit tests, these were diverged to a later pr.

Description of user facing changes:

None.

Description of developer facing changes:

The unit tests for NVDA objects move into a tests/unit/test_NVDAObjects package. test_NVDAObjects_UIA.py becomes test_NVDAObjects/test_UIA.py. test_NVDAObjects_IAccessible_ia2Web.py becomes test_NVDAObjects/test_IAccessible_ia2Web.py.

Description of development approach:

A new module, test_NVDAObjects/test_UIA_wordDocument.py, tests the comment support of Word via UI Automation. The UIA elements are mocks. The text ranges come from BasicTextProvider in the unit test helpers.

The tests cover:

  • The presentation of a comment, a comment without a date, a resolved comment and a reply.
  • The detection of resolved comments from the annotation types of the commented text.
  • Finding the thread of a reply, for modern and classic comments.
  • Fetching a thread with its replies. This includes the runtime ID of the thread element, and the text of a classic comment from its edit field.
  • Finding the comment at a position: comment hint buttons, threads, classic comments, other annotation objects, and the resolved state.
  • The comment items of the Elements List: the annotation types they match, their labels, the nesting of replies and revisions, and fetching replies only when the list moves past a comment.
  • Listing a comment once in the Elements List when consecutive comment items belong to the same thread. Comment items without a thread are never skipped.
  • The speech and braille output of NVDA+alt+c, and the browseable message when the command is pressed twice.
  • The deprecated getCommentInfoFromPosition and getPresentableCommentInfoFromPosition.

Testing strategy:

Unit tests.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@LeonarddeR
LeonarddeR requested a review from a team as a code owner October 2, 2026 05:22
@LeonarddeR
LeonarddeR requested review from SaschaCowley and a balanced review from Copilot October 2, 2026 05:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The suite misses dateless reply/resolved behavior and does not fully verify deferred reply fetching.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds UIA Word comment-thread unit coverage and reorganizes NVDA object tests into a dedicated package.

Changes:

  • Adds tests for comment presentation, resolution, navigation, and reporting.
  • Moves existing UIA and IA2 web tests into test_NVDAObjects.
File Description
tests/​unit/​test_NVDAObjects/​__init__.py Defines the new test package.
tests/​unit/​test_NVDAObjects/​test_UIA.py Relocates existing UIA tests.
tests/​unit/​test_NVDAObjects/​test_IAccessible_ia2Web.py Relocates existing IA2 web tests.
tests/​unit/​test_NVDAObjects/​test_UIA_wordDocument.py Adds Word comment-thread tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Oct 7, 2026
The tests cover the presentation of comments and replies,
the detection of resolved comments, the lookup of comment threads,
the nesting of replies in the elements list,
listing a comment once in the elements list,
the speech and braille output of NVDA+Alt+C,
and the deprecated comment functions.

Assisted-by: Claude:claude-opus-5-5
@LeonarddeR
LeonarddeR changed the base branch from master to beta November 10, 2026 08:17
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@seanbudd These tests are left from #20894 and belong to 2027.1 I think

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants