cthulhu/test/keystrokes/helpcontent/struct_nav_heading.py
2024-12-18 10:05:44 -05:00

189 lines
8.0 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 learn mode."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyPressAction(0, None, "KP_Insert"))
sequence.append(TypeAction("h"))
sequence.append(KeyReleaseAction(0, None, "KP_Insert"))
sequence.append(KeyComboAction("F1"))
sequence.append(PauseAction(2000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"1. h for next heading",
["BRAILLE LINE: ' Before You Begin h2'",
" VISIBLE: ' Before You Begin h2', cursor=2",
"BRAILLE LINE: ' Before You Begin h2'",
" VISIBLE: ' Before You Begin h2', cursor=2",
"SPEECH OUTPUT: 'Before You Begin heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"2. h for next heading",
["BRAILLE LINE: ' Getting Started h2'",
" VISIBLE: ' Getting Started h2', cursor=2",
"BRAILLE LINE: ' Getting Started h2'",
" VISIBLE: ' Getting Started h2', cursor=2",
"SPEECH OUTPUT: 'Getting Started heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"3. h for next heading",
["BRAILLE LINE: ' Reading Documents and Web Pages h2'",
" VISIBLE: 'Reading Documents and Web Pages ', cursor=1",
"BRAILLE LINE: ' Reading Documents and Web Pages h2'",
" VISIBLE: 'Reading Documents and Web Pages ', cursor=1",
"SPEECH OUTPUT: 'Reading Documents and Web Pages heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"4. h for next heading",
["BRAILLE LINE: ' Reviewing and Interacting with Screen Contents h2'",
" VISIBLE: 'Reviewing and Interacting with S', cursor=1",
"BRAILLE LINE: ' Reviewing and Interacting with Screen Contents h2'",
" VISIBLE: 'Reviewing and Interacting with S', cursor=1",
"SPEECH OUTPUT: 'Reviewing and Interacting with Screen Contents heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"5. h for next heading",
["BRAILLE LINE: ' Quick Reference h2'",
" VISIBLE: ' Quick Reference h2', cursor=2",
"BRAILLE LINE: ' Quick Reference h2'",
" VISIBLE: ' Quick Reference h2', cursor=2",
"SPEECH OUTPUT: 'Quick Reference heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"6. h for next heading",
["BRAILLE LINE: ' About h2'",
" VISIBLE: ' About h2', cursor=2",
"BRAILLE LINE: ' About h2'",
" VISIBLE: ' About h2', cursor=2",
"SPEECH OUTPUT: 'About heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("h"))
sequence.append(utils.AssertPresentationAction(
"7. h for next heading",
["BRAILLE LINE: 'Wrapping to top.'",
" VISIBLE: 'Wrapping to top.', cursor=0",
"BRAILLE LINE: ' Cthulhu's logo Cthulhu Screen Reader h1'",
" VISIBLE: 'Cthulhu's logo Cthulhu Screen Reader h', cursor=1",
"BRAILLE LINE: ' Cthulhu's logo Cthulhu Screen Reader h1'",
" VISIBLE: 'Cthulhu's logo Cthulhu Screen Reader h', cursor=1",
"SPEECH OUTPUT: 'Wrapping to top.' voice=system",
"SPEECH OUTPUT: 'Cthulhu's logo Cthulhu Screen Reader heading level 1'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"10. shift+h for previous heading",
["BRAILLE LINE: 'Wrapping to bottom.'",
" VISIBLE: 'Wrapping to bottom.', cursor=0",
"BRAILLE LINE: ' About h2'",
" VISIBLE: ' About h2', cursor=2",
"BRAILLE LINE: ' About h2'",
" VISIBLE: ' About h2', cursor=2",
"SPEECH OUTPUT: 'Wrapping to bottom.' voice=system",
"SPEECH OUTPUT: 'About heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"11. shift+h for previous heading",
["BRAILLE LINE: ' Quick Reference h2'",
" VISIBLE: ' Quick Reference h2', cursor=2",
"BRAILLE LINE: ' Quick Reference h2'",
" VISIBLE: ' Quick Reference h2', cursor=2",
"SPEECH OUTPUT: 'Quick Reference heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"12. shift+h for previous heading",
["BRAILLE LINE: ' Reviewing and Interacting with Screen Contents h2'",
" VISIBLE: 'Reviewing and Interacting with S', cursor=1",
"BRAILLE LINE: ' Reviewing and Interacting with Screen Contents h2'",
" VISIBLE: 'Reviewing and Interacting with S', cursor=1",
"SPEECH OUTPUT: 'Reviewing and Interacting with Screen Contents heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"13. shift+h for previous heading",
["BRAILLE LINE: ' Reading Documents and Web Pages h2'",
" VISIBLE: 'Reading Documents and Web Pages ', cursor=1",
"BRAILLE LINE: ' Reading Documents and Web Pages h2'",
" VISIBLE: 'Reading Documents and Web Pages ', cursor=1",
"SPEECH OUTPUT: 'Reading Documents and Web Pages heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"14. shift+h for previous heading",
["BRAILLE LINE: ' Getting Started h2'",
" VISIBLE: ' Getting Started h2', cursor=2",
"BRAILLE LINE: ' Getting Started h2'",
" VISIBLE: ' Getting Started h2', cursor=2",
"SPEECH OUTPUT: 'Getting Started heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"15. shift+h for previous heading",
["BRAILLE LINE: ' Before You Begin h2'",
" VISIBLE: ' Before You Begin h2', cursor=2",
"BRAILLE LINE: ' Before You Begin h2'",
" VISIBLE: ' Before You Begin h2', cursor=2",
"SPEECH OUTPUT: 'Before You Begin heading level 2'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>h"))
sequence.append(utils.AssertPresentationAction(
"16. shift+h for previous heading",
["BRAILLE LINE: ' Cthulhu's logo Cthulhu Screen Reader h1'",
" VISIBLE: 'Cthulhu's logo Cthulhu Screen Reader h', cursor=1",
"BRAILLE LINE: ' Cthulhu's logo Cthulhu Screen Reader h1'",
" VISIBLE: 'Cthulhu's logo Cthulhu Screen Reader h', cursor=1",
"SPEECH OUTPUT: 'Cthulhu's logo Cthulhu Screen Reader heading level 1'"]))
sequence.append(KeyComboAction("<Alt>F4"))
sequence.append(utils.AssertionSummaryAction())
sequence.start()