#!/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(KeyComboAction("End")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Down")) sequence.append(KeyComboAction("Return")) sequence.append(PauseAction(3000)) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("a")) sequence.append(utils.AssertPresentationAction( "1. Select all'", ["BRAILLE LINE: 'gtk3-demo application Hypertext frame Some text to show that simple hyper text can easily be realized with $l'", " VISIBLE: 'Some text to show that simple hy', cursor=1", "SPEECH OUTPUT: 'entire document selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Delete")) sequence.append(utils.AssertPresentationAction( "2. Delete the selection", ["BRAILLE LINE: 'gtk3-demo application Hypertext frame $l'", " VISIBLE: ' $l', cursor=1", "BRAILLE LINE: 'Selection deleted.'", " VISIBLE: 'Selection deleted.', cursor=0", "BRAILLE LINE: 'gtk3-demo application Hypertext frame $l'", " VISIBLE: 'frame $l', cursor=7", "SPEECH OUTPUT: 'Selection deleted.' voice=system"])) sequence.append(TypeAction("This is a test.")) sequence.append(KeyComboAction("Return")) sequence.append(TypeAction("This is another test.")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Home")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "3. Select two words'", ["BRAILLE LINE: 'gtk3-demo application Hypertext frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=5", "BRAILLE LINE: 'gtk3-demo application Hypertext frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=8", "SPEECH OUTPUT: 'This'", "SPEECH OUTPUT: 'selected' voice=system", "SPEECH OUTPUT: ' is'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("c")) sequence.append(utils.AssertPresentationAction( "4. Copy the selection", ["BRAILLE LINE: 'Copied selection to clipboard.'", " VISIBLE: 'Copied selection to clipboard.', cursor=0", "SPEECH OUTPUT: 'Copied selection to clipboard.' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("End")) sequence.append(utils.AssertPresentationAction( "5. End of file", ["BRAILLE LINE: 'gtk3-demo application Hypertext frame This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=8", "BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "SPEECH OUTPUT: 'This is'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Return")) sequence.append(utils.AssertPresentationAction( "6. Newline", ["BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("v")) sequence.append(utils.AssertPresentationAction( "7. Paste", ["BRAILLE LINE: 'This is $l'", " VISIBLE: 'This is $l', cursor=8", "BRAILLE LINE: 'Pasted contents from clipboard.'", " VISIBLE: 'Pasted contents from clipboard.', cursor=0", "BRAILLE LINE: 'This is $l'", " VISIBLE: 'This is $l', cursor=8", "SPEECH OUTPUT: 'Pasted contents from clipboard.' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Up")) sequence.append(utils.AssertPresentationAction( "8. Select Up", ["BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "SPEECH OUTPUT: '", "This is'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Up")) sequence.append(utils.AssertPresentationAction( "9. Select Up", ["BRAILLE LINE: 'This is another test. $l'", " VISIBLE: 'This is another test. $l', cursor=1", "SPEECH OUTPUT: 'This is another test.", "'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("x")) sequence.append(utils.AssertPresentationAction( "10. Cut the selection", ["BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "BRAILLE LINE: 'Cut selection to clipboard.'", " VISIBLE: 'Cut selection to clipboard.', cursor=0", "BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "SPEECH OUTPUT: 'Cut selection to clipboard.' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("x")) sequence.append(utils.AssertPresentationAction( "11. Cut with nothing selected", [""])) sequence.append(KeyComboAction("F4")) sequence.append(utils.AssertionSummaryAction()) sequence.start()