Skip to content

Honor useSpellingFunctionality parameter when reporting shortcuts#15572

Merged
seanbudd merged 9 commits into
nvaccess:masterfrom
CyrilleB79:fixNoSpelling
Oct 9, 2023
Merged

Honor useSpellingFunctionality parameter when reporting shortcuts#15572
seanbudd merged 9 commits into
nvaccess:masterfrom
CyrilleB79:fixNoSpelling

Conversation

@CyrilleB79

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #15566
Fix-up of #14900 / #15373.

Summary of the issue:

In #14900 / #15373., spelling mode was used (CharacterModeCommand) no matter the state of the "Use spelling functionality" option.

The use spelling functionality exists because some old SAPI synth do not support spelling mode correctly. For them, this option needs to be honored.

Description of user facing changes

Use spelling functionality option will now be honored when reporting shortcuts.

Description of development approach

See logic in the code.
If use spelling functionality option is disabled, the key is just reported as is.

Testing strategy:

Manual check:

  • Checked that reporting shortcuts is still OK
  • Checked in the log that CharacterModeCommand is used only when the "Use spelling functionality" option is enabled.

Known issues with pull request:

None

Change log

None: unreleased issue.

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.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 2daba6eda6

@CyrilleB79 CyrilleB79 marked this pull request as ready for review October 6, 2023 09:18
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner October 6, 2023 09:18
@CyrilleB79 CyrilleB79 requested a review from seanbudd October 6, 2023 09:18
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@seanbudd or any other reviewer:
I have had to fix the unit tests. Not sure however that function patching is the correct way to do this. Let me know if another approach is required.

@lukaszgo1 lukaszgo1 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.

Pretty nice overall!

Comment thread tests/unit/test_speechShortcutKeys.py Outdated
class Test_getKeyboardShortcutSpeech(unittest.TestCase):

@classmethod
def setUpClass(cls):

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.

Have you considered using unittest.mock.patch for replacing the function during the tests? When used as a decorator on these test classes you'll have much less of boilerplate code.

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.

It would be nice to have additional unit test confirming that when shouldUseSpellingFunctionality returns False, character mode commands are not used.

…r when Use spelling functionality is disabled.
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@lukaszgo1, many thanks for the review!

I am not used to unittest.mock.patch (and more generally nor to mock), but that's a really nice tool. Could you please double check that I am using it correctly?

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 19e37f8b1f

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@lukaszgo1, I think you are a user of MathPlayer.
Could you manual test the MathPlayer code that has been modified in this PR?

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit eb162c0024

Comment thread source/speech/shortcutKeys.py
Comment thread tests/unit/test_speechShortcutKeys.py Outdated
Comment thread tests/unit/test_speechShortcutKeys.py Outdated

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @CyrilleB79

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 8f1fa7a337

Comment thread tests/unit/test_speechShortcutKeys.py Outdated
@seanbudd seanbudd merged commit 3284d85 into nvaccess:master Oct 9, 2023
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Oct 9, 2023
@CyrilleB79 CyrilleB79 deleted the fixNoSpelling branch October 9, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updated shortcut key reporting doesn't respect use spelling functionality option

5 participants