[orca] Fix for bgo#593594 - Orca says "blank" when Firefox returns a bogus value for getTextAtOffset



commit 4ae1b68d79b8a61e01d066a4f09d062a189df910
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Aug 30 20:53:38 2009 -0400

    Fix for bgo#593594 - Orca says "blank" when Firefox returns a bogus value for getTextAtOffset

 src/orca/scripts/toolkits/Gecko/script.py      |   10 ++++++++++
 test/keystrokes/firefox/dojo_slider.py         |    9 ++++-----
 test/keystrokes/firefox/line_nav_bug_547573.py |    7 ++++---
 3 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 2f0c8a8..95b3d7b 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -5487,6 +5487,16 @@ class Script(default.Script):
             if not (start <= offset < end):
                 [line, start, end] = text.getTextAfterOffset(end, boundary)
 
+            # If we're still seeing bogusity, which we only seem to see when
+            # moving up, locate the previous character and use it instead.
+            #
+            if not (start <= offset < end):
+                pObj, pOffset = self.findPreviousCaretInOrder(obj, offset)
+                if pObj:
+                    obj, offset = pObj, pOffset
+                    text = self.queryNonEmptyText(obj)
+                    [line, start, end] = text.getTextAtOffset(offset, boundary)
+
             if start <= offset < end:
                 # So far so good. If the line doesn't begin with an EOC, we
                 # have our first character for this object.
diff --git a/test/keystrokes/firefox/dojo_slider.py b/test/keystrokes/firefox/dojo_slider.py
index 0478f91..a676810 100644
--- a/test/keystrokes/firefox/dojo_slider.py
+++ b/test/keystrokes/firefox/dojo_slider.py
@@ -192,17 +192,16 @@ sequence.append(utils.AssertPresentationAction(
 
 ########################################################################
 # Tab to the next entry between the sliders. 
-# [[[Bug?: not labeling properly.]]]
 #
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(PauseAction(1000))
 sequence.append(utils.AssertPresentationAction(
     "move to entry", 
-    ["BRAILLE LINE:  '10.0% $l rdonly'",
-     "     VISIBLE:  '10.0% $l rdonly', cursor=0",
-     "BRAILLE LINE:  '10.0% $l rdonly'",
-     "     VISIBLE:  '10.0% $l rdonly', cursor=0",
+    ["BRAILLE LINE:  'Slider1 Value: 10.0% $l rdonly'",
+     "     VISIBLE:  'Slider1 Value: 10.0% $l rdonly', cursor=0",
+     "BRAILLE LINE:  'Slider1 Value: 10.0% $l rdonly'",
+     "     VISIBLE:  'Slider1 Value: 10.0% $l rdonly', cursor=0",
      "SPEECH OUTPUT: 'Slider1 Value: read only text 10.0% selected'"]))
 
 ########################################################################
diff --git a/test/keystrokes/firefox/line_nav_bug_547573.py b/test/keystrokes/firefox/line_nav_bug_547573.py
index 2e96531..5cd6840 100644
--- a/test/keystrokes/firefox/line_nav_bug_547573.py
+++ b/test/keystrokes/firefox/line_nav_bug_547573.py
@@ -137,7 +137,7 @@ sequence.append(KeyComboAction("Down"))
 sequence.append(utils.AssertPresentationAction(
     "12. Line Down",
     ["BRAILLE LINE:  '   Installation of Self-Extracting Binary'",
-     "     VISIBLE:  '   Installation of Self-Extracti', cursor=1",
+     "     VISIBLE:  '   Installation of Self-Extracti', cursor=2",
      "SPEECH OUTPUT: '    Installation of Self-Extracting Binary link ",
      "'"]))
 
@@ -1567,8 +1567,9 @@ sequence.append(KeyComboAction("Up"))
 sequence.append(utils.AssertPresentationAction(
     "82. Line Up",
     ["BRAILLE LINE:  'Installation of Self-Extracting Binary'",
-     "     VISIBLE:  'Installation of Self-Extracting ', cursor=0",
-     "SPEECH OUTPUT: 'blank'"]))
+     "     VISIBLE:  'Installation of Self-Extracting ', cursor=1",
+     "SPEECH OUTPUT: 'Installation of Self-Extracting Binary link ",
+     "'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Up"))



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