Fixed status announcements interrupting page information for the web navigation.
This commit is contained in:
@@ -100,6 +100,69 @@ class WebKeyGrabRegressionTests(unittest.TestCase):
|
||||
testScript.refreshKeyGrabs.assert_called_once_with()
|
||||
|
||||
|
||||
class WebPresentationModeSpeechRegressionTests(unittest.TestCase):
|
||||
def _make_script(self, inFocusMode):
|
||||
testScript = web_script.Script.__new__(web_script.Script)
|
||||
testScript._inFocusMode = inFocusMode
|
||||
testScript._focusModeIsSticky = True
|
||||
testScript._browseModeIsSticky = True
|
||||
testScript._loadingDocumentContent = False
|
||||
testScript._lastCommandWasCaretNav = False
|
||||
testScript._lastCommandWasStructNav = False
|
||||
testScript.utilities = mock.Mock()
|
||||
testScript.utilities.getCaretContext.return_value = ("button", 0)
|
||||
testScript.utilities.grabFocusWhenSettingCaret.return_value = True
|
||||
testScript.presentMessage = mock.Mock()
|
||||
testScript.refreshKeyGrabs = mock.Mock()
|
||||
testScript._shouldSuppressBrowseModeSound = mock.Mock(return_value=False)
|
||||
return testScript
|
||||
|
||||
def test_automatic_browse_mode_announcement_does_not_interrupt_focus_presentation(self):
|
||||
testScript = self._make_script(inFocusMode=True)
|
||||
soundManager = mock.Mock()
|
||||
|
||||
with (
|
||||
mock.patch.object(web_script.AXObject, "get_parent", return_value=None),
|
||||
mock.patch.object(web_script.AXUtilities, "is_list_box", return_value=False),
|
||||
mock.patch.object(web_script.AXUtilities, "is_menu", return_value=False),
|
||||
mock.patch.object(web_script.sound_theme_manager, "getManager", return_value=soundManager),
|
||||
):
|
||||
web_script.Script.togglePresentationMode(testScript, None, "document")
|
||||
|
||||
testScript.presentMessage.assert_called_once_with(messages.MODE_BROWSE, interrupt=False)
|
||||
soundManager.playBrowseModeSound.assert_called_once_with()
|
||||
self.assertFalse(testScript._inFocusMode)
|
||||
self.assertFalse(testScript._focusModeIsSticky)
|
||||
self.assertFalse(testScript._browseModeIsSticky)
|
||||
testScript.refreshKeyGrabs.assert_called_once_with()
|
||||
|
||||
def test_automatic_focus_mode_announcement_does_not_interrupt_focus_presentation(self):
|
||||
testScript = self._make_script(inFocusMode=False)
|
||||
soundManager = mock.Mock()
|
||||
|
||||
with mock.patch.object(
|
||||
web_script.sound_theme_manager,
|
||||
"getManager",
|
||||
return_value=soundManager,
|
||||
):
|
||||
web_script.Script.togglePresentationMode(testScript, None, "document")
|
||||
|
||||
testScript.presentMessage.assert_called_once_with(messages.MODE_FOCUS, interrupt=False)
|
||||
soundManager.playFocusModeSound.assert_called_once_with()
|
||||
self.assertTrue(testScript._inFocusMode)
|
||||
self.assertFalse(testScript._focusModeIsSticky)
|
||||
self.assertFalse(testScript._browseModeIsSticky)
|
||||
testScript.refreshKeyGrabs.assert_called_once_with()
|
||||
|
||||
def test_manual_presentation_mode_toggle_still_interrupts(self):
|
||||
testScript = self._make_script(inFocusMode=False)
|
||||
|
||||
with mock.patch.object(web_script.sound_theme_manager, "getManager", return_value=mock.Mock()):
|
||||
web_script.Script.togglePresentationMode(testScript, object(), "document")
|
||||
|
||||
testScript.presentMessage.assert_called_once_with(messages.MODE_FOCUS, interrupt=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user