#!/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 Cthulhu's presentation of Writer word navigation.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(TypeAction("This is a test.")) sequence.append(KeyComboAction("Return")) sequence.append(TypeAction("So is this.")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Home")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "1. Select Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=6", "SPEECH OUTPUT: 'This '", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "2. Select Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=9", "SPEECH OUTPUT: 'is '", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "3. Select Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=11", "SPEECH OUTPUT: 'a '", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "4. Select Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=15", "SPEECH OUTPUT: 'test'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "5. Select Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=16", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "6. Unselect Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=15", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "7. Unselect Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=11", "SPEECH OUTPUT: 'test'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "8. Unselect Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=9", "SPEECH OUTPUT: 'a '", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "9. Unselect Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=6", "SPEECH OUTPUT: 'is '", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "10. Unselect Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=1", "SPEECH OUTPUT: 'This '", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("End")) sequence.append(utils.AssertPresentationAction( "11. Move to end of document", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: ' This is a test. $l', cursor=1", "BRAILLE LINE: ' $l'", " VISIBLE: ' $l', cursor=1", "SPEECH OUTPUT: 'blank'"])) sequence.append(KeyComboAction("Left")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "12. Select Previous Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=11", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "13. Select Previous Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=7", "SPEECH OUTPUT: 'this'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "14. Select Previous Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=4", "SPEECH OUTPUT: 'is '", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "15. Select Previous Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=1", "SPEECH OUTPUT: 'So '", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(KeyComboAction("Left")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "16. Select Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=15", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "17. Select Previous Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=11", "SPEECH OUTPUT: 'test'", "SPEECH OUTPUT: 'selected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "18. Unselect Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=15", "SPEECH OUTPUT: 'test'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "19. Unselect Next Word", ["BRAILLE LINE: 'soffice application Untitled 1 - LibreOffice Writer root pane Untitled 1 - LibreOffice Document This is a test. $l'", " VISIBLE: 'This is a test. $l', cursor=16", "SPEECH OUTPUT: 'dot'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(KeyComboAction("Right")) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "20. Unselect Next Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=4", "SPEECH OUTPUT: 'So '", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "21. Unselect Next Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=7", "SPEECH OUTPUT: 'is '", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "22. Unselect Next Word", ["BRAILLE LINE: 'So is this. $l'", " VISIBLE: 'So is this. $l', cursor=11", "SPEECH OUTPUT: 'this'", "SPEECH OUTPUT: 'unselected' voice=system"])) sequence.append(KeyComboAction("F4")) sequence.append(utils.AssertionSummaryAction()) sequence.start()