Only remove XML tags if JAB widget's text starts with <html> tag#13531
Conversation
See test results for failed build of commit 568b2858c3 |
michaelDCurran
left a comment
There was a problem hiding this comment.
The actual change looks fine to me.
But, Some unit tests would be great for testing _processHTML. Especially a unit test at very least for the label content in the issue. And perhaps a plain text label, and of course a label with valid html.
Add a new file to tests/unit
Name it something like test_javaAccessBridge.py
You could use a file like test_winVersion.py as an example, so you can see how to write the test class and methods.
Then you can run rununittests and ensure all of them pass.
|
I am on creating a test for this now. In fact I realised that by refactoring out to _processHTML would help me test it as it separates the logic for detecting and removing HTML tags from the accessibility API stuff. Also testing this in the future would be more important should we do things like replacing character entities and such like as the code could become more involved. |
|
Tests now written. |
Link to issue number:
Fixes #13102
Summary of the issue:
NVDA was incorrectly stripping text from Java widgets if the text looked like an XML tag. According to the Oracle Java docs, when using HTML in a Java widget you should start the text with the <html> tag.
Description of how this pull request fixes the issue:
This change gets NVDA to check if the text starts with <html> and only then will remove any text which appears to be XML tags.
Testing strategy:
Manually tested, some unit tests.
Known issues with pull request:
I haven't checked exactly what the regular expression does, but I suspect it does not handle entity substitution (eg. < with < and such like). Ideally this should also be fixed, but we may want to track that as a separate issue as its something slightly different to the original issue this is designed to fix.
Change log entries:
New features
Changes
Bug fixes
Fix issue where NVDA may incorrectly remove text from Java widgets when presenting to the user.
For Developers
Code Review Checklist: