cthulhu/test/keystrokes/gnome-terminal/nano.py
2024-12-18 10:05:44 -05:00

187 lines
6.1 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
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(TypeAction("nano"))
sequence.append(PauseAction(3000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Return"))
sequence.append(utils.AssertPresentationAction(
"1. Launch Nano",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: ' GNU nano [\d\.]+\s+New Buffer\s*",
"",
"'"]))
sequence.append(TypeAction("This is a test."))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction("So is this."))
sequence.append(KeyComboAction("Return"))
sequence.append(utils.StartRecordingAction())
sequence.append(TypeAction("Done."))
sequence.append(utils.AssertPresentationAction(
"2.Typing text",
["KNOWN ISSUE: We should be able to do less braille updating here",
"KNOWN ISSUE: We're speaking the initial D due to imperfect heuristics",
"BRAILLE LINE: 'D'",
" VISIBLE: 'D', cursor=2",
"BRAILLE LINE: 'Do'",
" VISIBLE: 'Do', cursor=3",
"BRAILLE LINE: 'Do'",
" VISIBLE: 'Do', cursor=3",
"BRAILLE LINE: 'Don'",
" VISIBLE: 'Don', cursor=4",
"BRAILLE LINE: 'Don'",
" VISIBLE: 'Don', cursor=4",
"BRAILLE LINE: 'Done'",
" VISIBLE: 'Done', cursor=5",
"BRAILLE LINE: 'Done'",
" VISIBLE: 'Done', cursor=5",
"BRAILLE LINE: 'Done.'",
" VISIBLE: 'Done.', cursor=6",
"BRAILLE LINE: 'Done.'",
" VISIBLE: 'Done.', cursor=6",
"SPEECH OUTPUT: 'D'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Return"))
sequence.append(utils.AssertPresentationAction(
"3. Return",
["KNOWN ISSUE: We're not speaking anything here",
"BRAILLE LINE: ''",
" VISIBLE: '', cursor=1"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"4. Up",
["BRAILLE LINE: 'Done.'",
" VISIBLE: 'Done.', cursor=1",
"SPEECH OUTPUT: 'Done.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"5. Up",
["BRAILLE LINE: 'So is this.'",
" VISIBLE: 'So is this.', cursor=1",
"SPEECH OUTPUT: 'So is this.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"6. Up",
["KNOWN ISSUE: Something is converting the space to a Tab. The Tab is really there, however.",
"BRAILLE LINE: 'This is a test.'",
" VISIBLE: 'This is a test.', cursor=1",
"SPEECH OUTPUT: 'This is a test.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"7. Up",
[""]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"8. Down",
["BRAILLE LINE: 'So is this.'",
" VISIBLE: 'So is this.', cursor=1",
"SPEECH OUTPUT: 'So is this.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"9. Down",
["BRAILLE LINE: 'Done.'",
" VISIBLE: 'Done.', cursor=1",
"SPEECH OUTPUT: 'Done.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"10. Down",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank' voice=system"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"11. Down",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank' voice=system"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"12. Down",
[""]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"13. Up",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank' voice=system"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"14. Up",
["BRAILLE LINE: 'Done.'",
" VISIBLE: 'Done.', cursor=1",
"SPEECH OUTPUT: 'Done.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"15. Up",
["BRAILLE LINE: 'So is this.'",
" VISIBLE: 'So is this.', cursor=1",
"SPEECH OUTPUT: 'So is this.'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"16. Up",
["BRAILLE LINE: 'This is a test.'",
" VISIBLE: 'This is a test.', cursor=1",
"SPEECH OUTPUT: 'This is a test.'"]))
sequence.append(utils.AssertionSummaryAction())
sequence.start()