#!/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 flat review of text and a toolbar.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(KeyComboAction("f")) sequence.append(TypeAction("Application class")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Tab")) sequence.append(PauseAction(3000)) sequence.append(TypeAction("This is a test. ")) sequence.append(KeyComboAction("Return")) sequence.append(TypeAction("This is only a test.")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Return")) sequence.append(TypeAction("PLEASE DO NOT PANIC.")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Home")) sequence.append(KeyComboAction("Down")) sequence.append(KeyComboAction("Down")) sequence.append(KeyComboAction("Down")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Subtract")) sequence.append(utils.AssertPresentationAction( "1. KP_Subtract to enter flat review", ["BRAILLE LINE: 'Entering flat review.'", " VISIBLE: 'Entering flat review.', cursor=0", "BRAILLE LINE: 'PLEASE DO NOT PANIC. $l'", " VISIBLE: 'PLEASE DO NOT PANIC. $l', cursor=1", "SPEECH OUTPUT: 'Entering flat review.' voice=system", "SPEECH OUTPUT: 'PLEASE '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_8")) sequence.append(utils.AssertPresentationAction( "2. KP_8 to flat review 'PLEASE DO NOT PANIC.'", ["BRAILLE LINE: 'PLEASE DO NOT PANIC. $l'", " VISIBLE: 'PLEASE DO NOT PANIC. $l', cursor=1", "SPEECH OUTPUT: 'PLEASE DO NOT PANIC.", "'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_5")) sequence.append(utils.AssertPresentationAction( "3. KP_5 to flat review 'PLEASE '", ["BRAILLE LINE: 'PLEASE DO NOT PANIC. $l'", " VISIBLE: 'PLEASE DO NOT PANIC. $l', cursor=1", "SPEECH OUTPUT: 'PLEASE '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_2")) sequence.append(utils.AssertPresentationAction( "4. KP_2 to flat review 'P'", ["BRAILLE LINE: 'PLEASE DO NOT PANIC. $l'", " VISIBLE: 'PLEASE DO NOT PANIC. $l', cursor=1", "SPEECH OUTPUT: 'P'"])) sequence.append(KeyComboAction("Home")) sequence.append(KeyComboAction("Down")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_5")) sequence.append(utils.AssertPresentationAction( "5. KP_5 to flat review 'This '", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_5")) sequence.append(KeyComboAction("KP_5")) sequence.append(utils.AssertPresentationAction( "6. KP_5 2X to spell 'This '", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This '", "SPEECH OUTPUT: 'T'", "SPEECH OUTPUT: 'h'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_5")) sequence.append(KeyComboAction("KP_5")) sequence.append(KeyComboAction("KP_5")) sequence.append(utils.AssertPresentationAction( "7. KP_5 3X to military spell 'This '", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This '", "SPEECH OUTPUT: 'T'", "SPEECH OUTPUT: 'h'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'tango'", "SPEECH OUTPUT: 'hotel'", "SPEECH OUTPUT: 'india'", "SPEECH OUTPUT: 'sierra'", "SPEECH OUTPUT: ' '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_8")) sequence.append(utils.AssertPresentationAction( "8. KP_8 to flat review 'This is only a test.'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This is only a test.", "'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_8")) sequence.append(KeyComboAction("KP_8")) sequence.append(utils.AssertPresentationAction( "9. KP_8 2X to spell 'This is only a test.'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This is only a test.", "'", "SPEECH OUTPUT: 'T'", "SPEECH OUTPUT: 'h'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'o'", "SPEECH OUTPUT: 'n'", "SPEECH OUTPUT: 'l'", "SPEECH OUTPUT: 'y'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'a'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 't'", "SPEECH OUTPUT: 'e'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 't'", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'newline'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_8")) sequence.append(KeyComboAction("KP_8")) sequence.append(KeyComboAction("KP_8")) sequence.append(utils.AssertPresentationAction( "10. KP_8 3X to military spell 'This is only a test.'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'This is only a test.", "'", "SPEECH OUTPUT: 'T'", "SPEECH OUTPUT: 'h'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'o'", "SPEECH OUTPUT: 'n'", "SPEECH OUTPUT: 'l'", "SPEECH OUTPUT: 'y'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 'a'", "SPEECH OUTPUT: 'space'", "SPEECH OUTPUT: 't'", "SPEECH OUTPUT: 'e'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 't'", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'newline'", "SPEECH OUTPUT: 'tango'", "SPEECH OUTPUT: 'hotel'", "SPEECH OUTPUT: 'india'", "SPEECH OUTPUT: 'sierra'", "SPEECH OUTPUT: ' '", "SPEECH OUTPUT: 'india'", "SPEECH OUTPUT: 'sierra'", "SPEECH OUTPUT: ' '", "SPEECH OUTPUT: 'oscar'", "SPEECH OUTPUT: 'november'", "SPEECH OUTPUT: 'lima'", "SPEECH OUTPUT: 'yankee'", "SPEECH OUTPUT: ' '", "SPEECH OUTPUT: 'alpha'", "SPEECH OUTPUT: ' '", "SPEECH OUTPUT: 'tango'", "SPEECH OUTPUT: 'echo'", "SPEECH OUTPUT: 'sierra'", "SPEECH OUTPUT: 'tango'", "SPEECH OUTPUT: '.'", "SPEECH OUTPUT: '", "'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_2")) sequence.append(utils.AssertPresentationAction( "11. KP_2 to flat review 'T'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'T'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_2")) sequence.append(KeyComboAction("KP_2")) sequence.append(utils.AssertPresentationAction( "12. KP_2 2X to military spell 'T'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'T'", "SPEECH OUTPUT: 'tango'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_6")) sequence.append(utils.AssertPresentationAction( "13. KP_6 to flat review 'is'", ["BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=6", "SPEECH OUTPUT: 'is '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_7")) sequence.append(utils.AssertPresentationAction( "14. KP_7 to flat review the scrollbar", ["BRAILLE LINE: 'vertical scroll bar 0% $l'", " VISIBLE: 'vertical scroll bar 0% $l', cursor=1", "SPEECH OUTPUT: 'vertical scroll bar 0 percent.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_7")) sequence.append(utils.AssertPresentationAction( "15. KP_7 to flat review 'This is a test.'", ["BRAILLE LINE: 'This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=1", "SPEECH OUTPUT: 'This is a test. ", "'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_7")) sequence.append(utils.AssertPresentationAction( "16. KP_7 to flat review toolbar", ["KNOWN ISSUE: gtk3-demo's toolbar widgets lack names that were present in the past", "BRAILLE LINE: 'push button & y Menu push button push button $l'", " VISIBLE: 'push button & y Menu push button', cursor=1", "SPEECH OUTPUT: 'push button not pressed Menu push button push button'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_7")) sequence.append(utils.AssertPresentationAction( "17. KP_7 to flat review menu", ["BRAILLE LINE: 'Preferences Help $l'", " VISIBLE: 'Preferences Help $l', cursor=1", "SPEECH OUTPUT: 'Preferences Help'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_5")) sequence.append(utils.AssertPresentationAction( "18. KP_5 to flat review 'Preferences'", ["BRAILLE LINE: 'Preferences Help $l'", " VISIBLE: 'Preferences Help $l', cursor=1", "SPEECH OUTPUT: 'Preferences'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_6")) sequence.append(utils.AssertPresentationAction( "19. KP_6 to flat review 'Help'", ["BRAILLE LINE: 'Preferences Help $l'", " VISIBLE: 'Preferences Help $l', cursor=13", "SPEECH OUTPUT: 'Help'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyPressAction(0, None, "KP_Insert")) sequence.append(KeyComboAction("KP_5")) sequence.append(KeyReleaseAction(0, None, "KP_Insert")) sequence.append(utils.AssertPresentationAction( "20. Insert+KP_5 to flat review 'Help' accessible", ["SPEECH OUTPUT: 'Help menu.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyPressAction(0, None, "KP_Insert")) sequence.append(KeyComboAction("KP_9")) sequence.append(KeyReleaseAction(0, None, "KP_Insert")) sequence.append(utils.AssertPresentationAction( "21. Insert+KP_9 to flat review end", ["BRAILLE LINE: 'Cursor at row 1 column 0 - 60 chars in document $l'", " VISIBLE: 'Cursor at row 1 column 0 - 60 ch', cursor=1", "SPEECH OUTPUT: 'Cursor at row 1 column 0 - 60 chars in document'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyPressAction(0, None, "KP_Insert")) sequence.append(KeyComboAction("KP_7")) sequence.append(KeyReleaseAction(0, None, "KP_Insert")) sequence.append(utils.AssertPresentationAction( "22. Insert+KP_7 to flat review home", ["BRAILLE LINE: 'Preferences Help $l'", " VISIBLE: 'Preferences Help $l', cursor=1", "SPEECH OUTPUT: 'Preferences Help'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyPressAction(0, None, "KP_Insert")) sequence.append(KeyComboAction("KP_6")) sequence.append(KeyReleaseAction(0, None, "KP_Insert")) sequence.append(utils.AssertPresentationAction( "23. Insert+KP_6 to flat review below", ["BRAILLE LINE: 'push button & y Menu push button push button $l'", " VISIBLE: 'push button & y Menu push button', cursor=1", "SPEECH OUTPUT: 'push '"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyPressAction(0, None, "KP_Insert")) sequence.append(KeyComboAction("KP_4")) sequence.append(KeyReleaseAction(0, None, "KP_Insert")) sequence.append(utils.AssertPresentationAction( "24. Insert+KP_4 to flat review above", ["BRAILLE LINE: 'Preferences Help $l'", " VISIBLE: 'Preferences Help $l', cursor=1", "SPEECH OUTPUT: 'Preferences'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Subtract")) sequence.append(utils.AssertPresentationAction( "25. KP_Subtract to exit flat review", ["BRAILLE LINE: 'Leaving flat review.'", " VISIBLE: 'Leaving flat review.', cursor=0", "BRAILLE LINE: 'This is only a test. $l'", " VISIBLE: 'This is only a test. $l', cursor=1", "SPEECH OUTPUT: 'Leaving flat review.' voice=system"])) sequence.append(utils.AssertionSummaryAction()) sequence.start()