#!/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 multiline editable text.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(PauseAction(3000)) sequence.append(KeyComboAction("f")) sequence.append(TypeAction("Application main window")) sequence.append(KeyComboAction("Return")) sequence.append(PauseAction(3000)) sequence.append(KeyComboAction("Tab")) sequence.append(TypeAction("This is a test.")) sequence.append(PauseAction(3000)) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Return")) sequence.append(utils.AssertPresentationAction( "1. Press Return after typing", ["BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1"])) sequence.append(TypeAction("Here is another test.")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Home")) sequence.append(utils.AssertPresentationAction( "2. Navigate home", ["BRAILLE LINE: 'gtk-demo application Application Window frame 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("Right")) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "3. Arrow to end of 'This'", ["BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=2", "BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=3", "BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=4", "BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=5", "SPEECH OUTPUT: 'h'", "SPEECH OUTPUT: 'i'", "SPEECH OUTPUT: 's'", "SPEECH OUTPUT: 'space'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "4. Select 'is a test'", ["BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=8", "BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=10", "BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=15", "SPEECH OUTPUT: ' is'", "SPEECH OUTPUT: 'selected'", "SPEECH OUTPUT: ' a'", "SPEECH OUTPUT: 'selected'", "SPEECH OUTPUT: ' test'", "SPEECH OUTPUT: 'selected'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "5. Unselect 'test'", ["BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=11", "SPEECH OUTPUT: 'test'", "SPEECH OUTPUT: 'unselected'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "6. Where Am I", ["BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=11", "SPEECH OUTPUT: 'text.'", "SPEECH OUTPUT: ' is a selected.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Down")) sequence.append(utils.AssertPresentationAction( "7. Shift Down", ["BRAILLE LINE: 'Here is another test. $l'", " VISIBLE: 'Here is another test. $l', cursor=10", "SPEECH OUTPUT: 'test.", "Here is a'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("End")) sequence.append(utils.AssertPresentationAction( "8. Shift End", ["BRAILLE LINE: 'Here is another test. $l'", " VISIBLE: 'Here is another test. $l', cursor=22", "SPEECH OUTPUT: 'nother test.'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "9. Basic Where Am I multiline selection", ["BRAILLE LINE: 'Here is another test. $l'", " VISIBLE: 'Here is another test. $l', cursor=22", "SPEECH OUTPUT: 'text.'", "SPEECH OUTPUT: ' is a test.", "Here is another test. selected.'"])) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "10. Detailed Where Am I multiline selection", ["BRAILLE LINE: 'Here is another test. $l'", " VISIBLE: 'Here is another test. $l', cursor=22", "SPEECH OUTPUT: 'text.'", "SPEECH OUTPUT: ' is a test.", "Here is another test. selected.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Home")) sequence.append(utils.AssertPresentationAction( "11. Navigate home", ["BRAILLE LINE: 'gtk-demo application Application Window frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=1", "SPEECH OUTPUT: ' is a test.", "Here is another test.'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Add")) sequence.append(utils.AssertPresentationAction( "12. SayAll", ["SPEECH OUTPUT: 'This is a test.", "'", "SPEECH OUTPUT: 'Here is another test.'"])) sequence.append(KeyComboAction("F4")) sequence.append(utils.AssertionSummaryAction()) sequence.start()