296 lines
14 KiB
Python
296 lines
14 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 combo boxes in Java's SwingSet2."""
|
|
|
|
from macaroon.playback import *
|
|
import utils
|
|
|
|
sequence = MacroSequence()
|
|
|
|
##########################################################################
|
|
# We wait for the demo to come up and for focus to be on the toggle button
|
|
#
|
|
#sequence.append(WaitForWindowActivate("SwingSet2",None))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
|
|
# Wait for entire window to get populated.
|
|
sequence.append(PauseAction(5000))
|
|
|
|
##########################################################################
|
|
# Tab over to the combo box demo, and activate it.
|
|
#
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(TypeAction(" "))
|
|
|
|
##########################################################################
|
|
# Tab all the way down to the button page tab.
|
|
#
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("ComboBox Demo", acc_role=pyatspi.ROLE_PAGE_TAB))
|
|
|
|
sequence.append(PauseAction(5000))
|
|
|
|
##########################################################################
|
|
# Focusing over first combo box
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("Philip, Howard, Jeff",
|
|
acc_role=pyatspi.ROLE_COMBO_BOX))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"1. focusing over first combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
|
|
" VISIBLE: 'Presets: Philip, Howard, Jeff Co', cursor=10",
|
|
"SPEECH OUTPUT: 'Presets: Philip, Howard, Jeff combo box'"]))
|
|
|
|
########################################################################
|
|
# Do a basic "Where Am I" via KP_Enter.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("KP_Enter"))
|
|
sequence.append(PauseAction(3000))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"2. basic Where Am I",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
|
|
" VISIBLE: 'Presets: Philip, Howard, Jeff Co', cursor=10",
|
|
"SPEECH OUTPUT: 'Presets: combo box Philip, Howard, Jeff 1 of 10'"]))
|
|
|
|
##########################################################################
|
|
# Bring up combo box list by pressing space
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(TypeAction(" "))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"3. Expand combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
|
|
" VISIBLE: 'Presets: Philip, Howard, Jeff Co', cursor=10",
|
|
"SPEECH OUTPUT: 'Philip, Howard, Jeff'"]))
|
|
##########################################################################
|
|
# Arrow down to next list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Down"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"4. Arrow Down",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Jeff, Larry, Philip Combo'",
|
|
" VISIBLE: 'Presets: Jeff, Larry, Philip Com', cursor=10",
|
|
"SPEECH OUTPUT: 'Jeff, Larry, Philip'"]))
|
|
|
|
##########################################################################
|
|
# Arrow down to next list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Down"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"5. Arrow Down",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Howard, Scott, Hans Combo'",
|
|
" VISIBLE: 'Presets: Howard, Scott, Hans Com', cursor=10",
|
|
"SPEECH OUTPUT: 'Howard, Scott, Hans'"]))
|
|
|
|
########################################################################
|
|
# [[[BUG 483212: Missing significant information when performing where am i on combo box items]]]
|
|
# Do a basic "Where Am I" via KP_Enter. The following should be
|
|
# presented:
|
|
#
|
|
# SPEECH OUTPUT: 'Howard, Scott, Hans'
|
|
# SPEECH OUTPUT: 'label'
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("KP_Enter"))
|
|
sequence.append(PauseAction(3000))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"6. basic Where Am I",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Howard, Scott, Hans Combo'",
|
|
" VISIBLE: 'Presets: Howard, Scott, Hans Com', cursor=10",
|
|
"SPEECH OUTPUT: 'Presets: combo box Howard, Scott, Hans 3 of 8'"]))
|
|
|
|
##########################################################################
|
|
# Arrow down to next list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Down"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"7. Arrow Down",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Jeff, Hans Combo'",
|
|
" VISIBLE: 'Presets: Philip, Jeff, Hans Comb', cursor=10",
|
|
"SPEECH OUTPUT: 'Philip, Jeff, Hans'"]))
|
|
|
|
##########################################################################
|
|
# Press return to close list and select current item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Return"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"8. Collapse combo box",
|
|
["KNOWN ISSUE - Cthulhu often doesn't speak when Return is used to collapse a combo box; this is not limited to Java."]))
|
|
|
|
########################################################################
|
|
# Do a basic "Where Am I" via KP_Enter.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("KP_Enter"))
|
|
sequence.append(PauseAction(3000))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"9. basic Where Am I",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Jeff, Hans Combo'",
|
|
" VISIBLE: 'Presets: Philip, Jeff, Hans Comb', cursor=10",
|
|
"SPEECH OUTPUT: 'Presets: combo box Philip, Jeff, Hans 4 of 8'"]))
|
|
|
|
##########################################################################
|
|
# Bring up combo box list by pressing space, the following should be
|
|
# in output:
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(TypeAction(" "))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"10. Expand combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Jeff, Hans Combo'",
|
|
" VISIBLE: 'Presets: Philip, Jeff, Hans Comb', cursor=10",
|
|
"SPEECH OUTPUT: 'Philip, Jeff, Hans'"]))
|
|
|
|
##########################################################################
|
|
# Arrow up to previous list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Up"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"11. Arrow Up",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Howard, Scott, Hans Combo'",
|
|
" VISIBLE: 'Presets: Howard, Scott, Hans Com', cursor=10",
|
|
"SPEECH OUTPUT: 'Howard, Scott, Hans'"]))
|
|
|
|
##########################################################################
|
|
# Arrow up to previous list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Up"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"12. Arrow Up",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Jeff, Larry, Philip Combo'",
|
|
" VISIBLE: 'Presets: Jeff, Larry, Philip Com', cursor=10",
|
|
"SPEECH OUTPUT: 'Jeff, Larry, Philip'"]))
|
|
|
|
##########################################################################
|
|
# Arrow up to previous list item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Up"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"13. Arrow Up",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
|
|
" VISIBLE: 'Presets: Philip, Howard, Jeff Co', cursor=10",
|
|
"SPEECH OUTPUT: 'Philip, Howard, Jeff'"]))
|
|
|
|
##########################################################################
|
|
# Press return to close list and select current item.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Return"))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"14. Collapse combo box",
|
|
["KNOWN ISSUE - Cthulhu often doesn't speak when Return is used to collapse a combo box; this is not limited to Java."]))
|
|
|
|
##########################################################################
|
|
# Tab to next combo box.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("Philip", acc_role=pyatspi.ROLE_COMBO_BOX))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"15. Tab to next combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Hair: Philip Combo'",
|
|
" VISIBLE: 'Hair: Philip Combo', cursor=7",
|
|
"SPEECH OUTPUT: 'Hair: Philip combo box'"]))
|
|
|
|
##########################################################################
|
|
# Tab to next combo box.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("Howard", acc_role=pyatspi.ROLE_COMBO_BOX))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"16. Tab to next combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Eyes & Nose: Howard Combo'",
|
|
" VISIBLE: 'Eyes & Nose: Howard Combo', cursor=14",
|
|
"SPEECH OUTPUT: 'Eyes & Nose: Howard combo box'"]))
|
|
|
|
##########################################################################
|
|
# Tab to next combo box.
|
|
#
|
|
sequence.append(utils.StartRecordingAction())
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("Jeff", acc_role=pyatspi.ROLE_COMBO_BOX))
|
|
sequence.append(utils.AssertPresentationAction(
|
|
"17. Tab to next combo box",
|
|
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Mouth: Jeff Combo'",
|
|
" VISIBLE: 'Mouth: Jeff Combo', cursor=8",
|
|
"SPEECH OUTPUT: 'Mouth: Jeff combo box'"]))
|
|
|
|
##########################################################################
|
|
# Tab back up to starting state
|
|
#
|
|
sequence.append(KeyComboAction("Tab"))
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TEXT))
|
|
sequence.append(KeyComboAction("Tab"))
|
|
|
|
sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
|
|
# Toggle the top left button, to return to normal state.
|
|
sequence.append(TypeAction (" "))
|
|
|
|
# Just a little extra wait to let some events get through.
|
|
#
|
|
sequence.append(PauseAction(3000))
|
|
|
|
sequence.start()
|