Skip to content

Fix several issues in speech manager#11245

Merged
feerrenrut merged 13 commits into
masterfrom
addSpeechManagerUnitTests
Jun 16, 2020
Merged

Fix several issues in speech manager#11245
feerrenrut merged 13 commits into
masterfrom
addSpeechManagerUnitTests

Conversation

@feerrenrut

Copy link
Copy Markdown
Contributor

Please note, this is a large change, though most of the changes are unit tests. I have tried structure the commits in a logical order and keep changes separate. Please consider looking at the commits first to get an overview of the changes. The tests and extra debug logging is added first and the bugs are then fixed.

Note that this is blocking the 2020.2 release.

Link to issue number:

fixes #11132 - Say-all repeats some lines
fixes #11144 - Attempt to cancel speech for expired focus events: dialog title discarded when finding text in browse mode

Summary of the issue:

For #11132 - Say-all repeats some lines:

During say-all, after hitting an index, speechManager._handleIndex calls back to sayallHandler results in calling speechManager.speak and thus _pushNextSpeech, speechManager._handleIndex then goes on to call _pushNextSpeech itself.

For #11144 - Attempt to cancel speech for expired focus events: dialog title discarded when finding text in browse mode:

Titles were being dropped because they once had focus but when focus moves to the active control (automatically) they are considered previous focus and cancelled. In addition to this, removing cancelled speech was happening before all dependencies of the isValid callback were updated.

Wrapped indexes

During investigation I noticed that indexes were being compared naively, despite the fact that they are wrapped at a value of 10000. The indexes are not reset, it is feasible that this limit could be hit within a day and would cause some weird results.

Description of how this pull request fixes the issue:

This PR adds a lot of unit tests:

To support the unit tests, which could become hard to read and understand very quickly, a specific test harness was developed. There are a number of outputs to monitor, and it is useful to be able to assert the pre/post conditions for each step. To achieve this the test harness uses a context manager (see unit.test_speechManager.speechManagerTestHarness.SpeechManagerInteractions.expectation) which allows several post conditions to be added during the scope of a with block. These conditions are saved and used as the preconditions for the next with block.

Testing performed:

  • Unit tests
  • Manual testing of say-all double speaking case (with and without cancellable speech)
  • Manual testing of changing focus rapidly in focus mode (moving through email subjects with up and down arrow) in Gmail in Chrome
  • Manual testing of dialog title reporting with the run-dialog.

Known issues with pull request:

None.

Change log entry:

None

@feerrenrut

Copy link
Copy Markdown
Contributor Author

Note: Most of the unit tests use the speechManager class (and it’s current behavior) as an “oracle” to define the expected result. They probably don't need careful review. They will help us preserve the existing behavior and only alter it with purpose.

Comment thread tests/unit/test_speechManager/speechManagerTestHarness.py Outdated
Comment thread tests/unit/test_speechManager/__init__.py Outdated
Comment thread source/eventHandler.py Outdated
@feerrenrut

Copy link
Copy Markdown
Contributor Author

Thanks @lukaszgo1, I have fixed those typos.

If anyone wishes to test this build here is a link to the PR build on appveyor

@feerrenrut

Copy link
Copy Markdown
Contributor Author

Since this is blocking the release, and the changes to the speech manager are fairly minor (the majority of the changes are added unit tests) I will go ahead and merge this. I will address further review actions in a subsequent PR.

@feerrenrut feerrenrut merged commit c7a1e08 into master Jun 16, 2020
@feerrenrut feerrenrut deleted the addSpeechManagerUnitTests branch June 16, 2020 08:25
@nvaccessAuto nvaccessAuto added this to the 2020.2 milestone Jun 16, 2020
feerrenrut added a commit that referenced this pull request Mar 17, 2021
First introduced with "Cancellable speech #10885"
Several issues fixed with "Fix several issues in speech manager #11245"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attempt to cancel speech for expired focus events: dialog title discarded when finding text in browse mode Say-all repeats some lines.

3 participants