cthulhu/test/keystrokes/gtk-demo/spoken_indentation.py
2024-12-18 10:05:44 -05:00

320 lines
11 KiB
Python

#!/usr/bin/env python3
#
# Copyright (c) 2024 Stormux
# Copyright (c) 2010-2012 The Orca Team
# Copyright (c) 2012 Igalia, S.L.
# Copyright (c) 2005-2010 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
#
# Fork of Orca Screen Reader (GNOME)
# Original source: https://gitlab.gnome.org/GNOME/orca
"""Test of presentation of whitespace with braille disabled."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(KeyComboAction("<Control>f"))
sequence.append(TypeAction("Application main window"))
sequence.append(KeyComboAction("Return"))
sequence.append(PauseAction(3000))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction("foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction("foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction("foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction("foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction(" "))
sequence.append(KeyComboAction("Tab"))
sequence.append(TypeAction("foo"))
sequence.append(KeyComboAction("Return"))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Control>Home"))
sequence.append(utils.AssertPresentationAction(
"1. 1 Tab",
["SPEECH OUTPUT: 'left control '",
"SPEECH OUTPUT: '1 tab ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"2. 1 Tab and the word 'foo'",
["SPEECH OUTPUT: '1 tab ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"3. 2 Tabs",
["SPEECH OUTPUT: '2 tabs ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"4. 2 Tabs and the word 'foo'",
["SPEECH OUTPUT: '2 tabs ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"5. 1 space",
["SPEECH OUTPUT: '1 space ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"6. 1 space and the word 'foo'",
["SPEECH OUTPUT: '1 space ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"7. 2 spaces",
["SPEECH OUTPUT: '2 spaces ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"8. 2 spaces and the word 'foo'",
["SPEECH OUTPUT: '2 spaces ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"9. 1 Tab and 1 space",
["SPEECH OUTPUT: '1 tab 1 space ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"10. 1 Tab, 1 space, and the word 'foo'",
["SPEECH OUTPUT: '1 tab 1 space ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"11. 1 Tab and 2 spaces",
["SPEECH OUTPUT: '1 tab 2 spaces ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"12. 1 Tab, 2 spaces, and the word 'foo'",
["SPEECH OUTPUT: '1 tab 2 spaces ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"13. 2 Tabs and 1 space",
["SPEECH OUTPUT: '2 tabs 1 space ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"14. 2 Tabs, 1 space, and the word 'foo'",
["SPEECH OUTPUT: '2 tabs 1 space ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"15. 2 Tabs and 2 spaces",
["SPEECH OUTPUT: '2 tabs 2 spaces ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"16. 2 Tabs, 2 spaces, and the word 'foo'",
["SPEECH OUTPUT: '2 tabs 2 spaces ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"17. 1 Tab, 1 space, and 1 Tab",
["SPEECH OUTPUT: '1 tab 1 space 1 tab ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"18. 1 Tab, 1 space, 1 Tab, and the word 'foo'",
["SPEECH OUTPUT: '1 tab 1 space 1 tab ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"19. 1 Tab, 1 space, 1 Tab, and 1 space",
["SPEECH OUTPUT: '1 tab 1 space 1 tab 1 space ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"20. 1 Tab, 1 space, 1 Tab, 1 space, and the word 'foo'",
["SPEECH OUTPUT: '1 tab 1 space 1 tab 1 space ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"21. 1 Tab, 2 spaces, and 1 Tab",
["SPEECH OUTPUT: '1 tab 2 spaces 1 tab ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"22. 1 Tab, 2 spaces, 1 Tab, and the word 'foo'",
["SPEECH OUTPUT: '1 tab 2 spaces 1 tab ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"23. 2 spaces and 1 Tab",
["SPEECH OUTPUT: '2 spaces 1 tab ' voice=system",
"SPEECH OUTPUT: ' '"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"24. 2 spaces, 1 Tab, and the word 'foo'",
["SPEECH OUTPUT: '2 spaces 1 tab ' voice=system",
"SPEECH OUTPUT: ' foo'"]))
sequence.append(KeyComboAction("<Alt>F4"))
sequence.append(utils.AssertionSummaryAction())
sequence.start()