[orca/570658] Present the same thing for XUL combo boxes as we do Gtk+ combo boxes



commit 48be501cf1b832837a91af126d677c5c92eb1c68
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Jul 5 20:44:53 2009 -0400

    Present the same thing for XUL combo boxes as we do Gtk+ combo boxes
    
    I took a look at what we present for a labelled combo box for which we are
    not doing any special scripting (the Show combo box in packagemanager). In
    that case, we always present the label but move the cursor to the beginning
    of the selected item if the combo box is collapsed. For expanded combo boxes,
    the label and the currently displayed item in the combo box are included as
    part of the braille context, but only the selected/highlighted item in the
    menu is shown on the display. Done and done.

 .../scripts/toolkits/Gecko/braille_generator.py    |   11 ++++++++
 test/keystrokes/firefox/xul_role_combo_box.py      |   26 ++++++++++----------
 2 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/braille_generator.py b/src/orca/scripts/toolkits/Gecko/braille_generator.py
index 57aadc1..4ceba60 100644
--- a/src/orca/scripts/toolkits/Gecko/braille_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/braille_generator.py
@@ -241,6 +241,17 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
             self._script.isAriaWidget(obj) \
             or ((obj.getRole() == pyatspi.ROLE_LIST) \
                 and (not obj.getState().contains(pyatspi.STATE_FOCUSABLE)))
+        # Treat menu items in collapsed combo boxes as if the combo box
+        # had focus. This will make things more consistent with how we
+        # present combo boxes outside of Gecko.
+        #
+        if obj.getRole() == pyatspi.ROLE_MENU_ITEM:
+            comboBox = self._script.getAncestor(obj,
+                                                [pyatspi.ROLE_COMBO_BOX],
+                                                [pyatspi.ROLE_FRAME])
+            if comboBox \
+               and not comboBox.getState().contains(pyatspi.STATE_EXPANDED):
+                obj = comboBox
         result.extend(braille_generator.BrailleGenerator.\
                           generateBraille(self, obj, **args))
         del args['includeContext']
diff --git a/test/keystrokes/firefox/xul_role_combo_box.py b/test/keystrokes/firefox/xul_role_combo_box.py
index 271a0cc..2254531 100644
--- a/test/keystrokes/firefox/xul_role_combo_box.py
+++ b/test/keystrokes/firefox/xul_role_combo_box.py
@@ -46,10 +46,10 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Down"))
 sequence.append(utils.AssertPresentationAction(
     "Down Arrow in combobox",
-    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
-     "     VISIBLE:  'Show a blank page', cursor=1",
+    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my windows and tabs from last time Combo'",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my win', cursor=22",
      "BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my windows and tabs from last time Combo'",
-     "     VISIBLE:  'Show my windows and tabs from la', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my win', cursor=22",
      "SPEECH OUTPUT: 'Show a blank page'",
      "SPEECH OUTPUT: 'Show my windows and tabs from last time'"]))
 
@@ -61,7 +61,7 @@ sequence.append(KeyComboAction("Down"))
 sequence.append(utils.AssertPresentationAction(
     "Down Arrow in combobox",
     ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my home page Combo'",
-     "     VISIBLE:  'Show my home page', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my hom', cursor=22",
      "SPEECH OUTPUT: 'Show my home page'"]))
 
 ########################################################################
@@ -72,7 +72,7 @@ sequence.append(KeyComboAction("Up"))
 sequence.append(utils.AssertPresentationAction(
     "Up Arrow in combobox",
     ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my windows and tabs from last time Combo'",
-     "     VISIBLE:  'Show my windows and tabs from la', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my win', cursor=22",
      "SPEECH OUTPUT: 'Show my windows and tabs from last time'"]))
 
 ########################################################################
@@ -83,7 +83,7 @@ sequence.append(KeyComboAction("Up"))
 sequence.append(utils.AssertPresentationAction(
     "Up Arrow in combobox",
     ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
-     "     VISIBLE:  'Show a blank page', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show a blan', cursor=22",
      "SPEECH OUTPUT: 'Show a blank page'"]))
 
 ########################################################################
@@ -103,7 +103,7 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Down"))
 sequence.append(utils.AssertPresentationAction(
     "Down Arrow in expanded combobox",
-    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my windows and tabs from last time Combo'",
+    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo Show my windows and tabs from last time'",
      "     VISIBLE:  'Show my windows and tabs from la', cursor=1",
      "SPEECH OUTPUT: 'Show my windows and tabs from last time'"]))
 
@@ -114,7 +114,7 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Up"))
 sequence.append(utils.AssertPresentationAction(
     "Up Arrow in expanded combobox",
-    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
+    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo Show a blank page'",
      "     VISIBLE:  'Show a blank page', cursor=1",
      "SPEECH OUTPUT: 'Show a blank page'"]))
 
@@ -136,10 +136,10 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction("s"))
 sequence.append(utils.AssertPresentationAction(
     "First letter navigation with s",
-    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
-     "     VISIBLE:  'Show a blank page', cursor=1",
+    ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my home page Combo'",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my hom', cursor=22",
      "BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show my home page Combo'",
-     "     VISIBLE:  'Show my home page', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show my hom', cursor=22",
      "SPEECH OUTPUT: 'Show a blank page'",
      "SPEECH OUTPUT: 'Show my home page'"]))
 
@@ -148,7 +148,7 @@ sequence.append(TypeAction("s"))
 sequence.append(utils.AssertPresentationAction(
     "First letter navigation with s",
     ["BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
-     "     VISIBLE:  'Show a blank page', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show a blan', cursor=22",
      "SPEECH OUTPUT: 'Show a blank page'"]))
 
 ########################################################################
@@ -161,7 +161,7 @@ sequence.append(utils.AssertPresentationAction(
     "Basic Where Am I", 
     ["BUG? - We claim this is item 1 of 1. This is how it was before the refactor as well.",
      "BRAILLE LINE:  '" + utils.firefoxAppNames + " Application " + utils.firefoxAppNames + " Preferences Frame Main ScrollPane Startup Panel When " + utils.firefoxAppNames + " starts: Show a blank page Combo'",
-     "     VISIBLE:  'Show a blank page', cursor=1",
+     "     VISIBLE:  'When " + utils.firefoxAppNames + " starts: Show a blan', cursor=22",
      "SPEECH OUTPUT: 'When " + utils.firefoxAppNames + " starts: combo box Show a blank page item 1 of 1'"]))
 
 ########################################################################



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]