[orca/gnome-3-14] Fix an instance of structural navigation skipping



commit e1b7789a217db91c0320fde5c6acb8246dfe0422
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Sep 6 01:09:15 2014 -0400

    Fix an instance of structural navigation skipping

 src/orca/structural_navigation.py                  |   21 ++++++-
 test/html/hidden-float-repeat.html                 |   13 ++++
 .../firefox/html_struct_nav_bug_554616.py          |    5 +-
 .../html_struct_nav_heading_in_div_with_text.py    |   71 ++++++++++++++++++--
 4 files changed, 101 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 5378731..145f083 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -958,7 +958,7 @@ class StructuralNavigation:
         whether wrapping took place.
         """
 
-        currentObj = currentObj or self.getCurrentObject()
+        [currentObj, offset] = self._script.getCaretContext()
         document = self._getDocument()
 
         # If the current object is the document itself, find an actual
@@ -968,6 +968,25 @@ class StructuralNavigation:
         #
         if self._script.utilities.isSameObject(currentObj, document):
             currentObj = self._findNextObject(currentObj, document)
+            offset = 0
+
+        # If the caret context is in a block element that contains children,
+        # the "next" match as far as the collection interface is concerned
+        # is actually the "previous" match as far as we're concerned.
+        nextMatch = collection.getMatchesFrom(
+            currentObj,
+            matchRule,
+            collection.SORT_ORDER_CANONICAL,
+            collection.TREE_INORDER,
+            1,
+            True)
+
+        if nextMatch and nextMatch[0].parent == currentObj:
+            o = self._script.utilities.characterOffsetInParent(nextMatch[0])
+            if 0 <= o < offset \
+               and not self._script.utilities.isHidden(nextMatch[0]) \
+               and (not predicate or predicate(nextMatch[0])):
+                return nextMatch[0], False
 
         ancestors = []
         obj = currentObj.parent
diff --git a/test/html/hidden-float-repeat.html b/test/html/hidden-float-repeat.html
new file mode 100644
index 0000000..4185691
--- /dev/null
+++ b/test/html/hidden-float-repeat.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div>1</div>
+<div>
+   <span style="float:right; overflow:hidden">&nbsp;</span>
+   <div style="overflow:hidden">2</div>
+</div>
+<div>3</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/html_struct_nav_bug_554616.py 
b/test/keystrokes/firefox/html_struct_nav_bug_554616.py
index 5bb377c..ce99f70 100644
--- a/test/keystrokes/firefox/html_struct_nav_bug_554616.py
+++ b/test/keystrokes/firefox/html_struct_nav_bug_554616.py
@@ -7,6 +7,7 @@ import utils
 
 sequence = MacroSequence()
 
+sequence.append(PauseAction(3000))
 sequence.append(KeyComboAction("<Control>Home"))
 
 sequence.append(utils.StartRecordingAction())
@@ -153,8 +154,7 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("<Alt><Shift>Home"))
 sequence.append(utils.AssertPresentationAction(
     "9. Alt Shift Home",
-    ["KNOWN ISSUE: We are double-presenting the column header text in speech",
-     "BRAILLE LINE:  'installer (10186 KB)'",
+    ["BRAILLE LINE:  'installer (10186 KB)'",
      "     VISIBLE:  'installer (10186 KB)', cursor=1",
      "BRAILLE LINE:  'Snapshot version Date (UTC) Download'",
      "     VISIBLE:  'Snapshot version Date (UTC) Down', cursor=1",
@@ -163,7 +163,6 @@ sequence.append(utils.AssertPresentationAction(
      "BRAILLE LINE:  'Row 1, column 1.'",
      "     VISIBLE:  'Row 1, column 1.', cursor=0",
      "SPEECH OUTPUT: 'Snapshot version'",
-     "SPEECH OUTPUT: 'Snapshot version'",
      "SPEECH OUTPUT: 'column header'",
      "SPEECH OUTPUT: 'Row 1, column 1.' voice=system"]))
 
diff --git a/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py 
b/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
index de068e2..ac734d8 100644
--- a/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
+++ b/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-"""Test of structural navigation by blockquote."""
+"""Test of structural navigation by heading."""
 
 from macaroon.playback import *
 import utils
@@ -12,7 +12,7 @@ sequence.append(KeyComboAction("<Control>Home"))
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("2"))
 sequence.append(utils.AssertPresentationAction(
-    "1. 2 for first heading", 
+    "1. 2 for first heading",
     ["BRAILLE LINE:  'First Heading h2'",
      "     VISIBLE:  'First Heading h2', cursor=1",
      "SPEECH OUTPUT: 'First Heading '",
@@ -22,7 +22,7 @@ sequence.append(utils.AssertPresentationAction(
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Down"))
 sequence.append(utils.AssertPresentationAction(
-    "2. Down Arrow to text", 
+    "2. Down Arrow to text after First Heading",
     ["BRAILLE LINE:  'text'",
      "     VISIBLE:  'text', cursor=1",
      "SPEECH OUTPUT: 'text '"]))
@@ -30,10 +30,71 @@ sequence.append(utils.AssertPresentationAction(
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("2"))
 sequence.append(utils.AssertPresentationAction(
-    "3. 2 for second heading", 
-    ["KNOWN ISSUE: This is not the second heading. We looped.",
+    "3. 2 to move to the next heading",
+    ["BRAILLE LINE:  'Second Heading h2'",
+     "     VISIBLE:  'Second Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'Second Heading '",
+     "SPEECH OUTPUT: 'link'",
+     "SPEECH OUTPUT: 'heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Down Arrow to text after First Heading",
+    ["BRAILLE LINE:  'text'",
+     "     VISIBLE:  'text', cursor=1",
+     "SPEECH OUTPUT: 'text '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>2"))
+sequence.append(utils.AssertPresentationAction(
+    "5. Shift+2 to move to the previous heading",
+    ["BRAILLE LINE:  'Second Heading h2'",
+     "     VISIBLE:  'Second Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'Second Heading '",
+     "SPEECH OUTPUT: 'link'",
+     "SPEECH OUTPUT: 'heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "6. Up Arrow to text after First Heading",
+    ["BRAILLE LINE:  'text'",
+     "     VISIBLE:  'text', cursor=1",
+     "SPEECH OUTPUT: 'text '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>2"))
+sequence.append(utils.AssertPresentationAction(
+    "7. Shift+2 to move to the previous heading",
+    ["BRAILLE LINE:  'First Heading h2'",
+     "     VISIBLE:  'First Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'First Heading '",
+     "SPEECH OUTPUT: 'link'",
+     "SPEECH OUTPUT: 'heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>2"))
+sequence.append(utils.AssertPresentationAction(
+    "8. Shift+2 to move to the previous heading",
+    ["BRAILLE LINE:  'Wrapping to bottom.'",
+     "     VISIBLE:  'Wrapping to bottom.', cursor=0",
+     "BRAILLE LINE:  'Second Heading h2'",
+     "     VISIBLE:  'Second Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'Wrapping to bottom.' voice=system",
+     "SPEECH OUTPUT: 'Second Heading '",
+     "SPEECH OUTPUT: 'link'",
+     "SPEECH OUTPUT: 'heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("2"))
+sequence.append(utils.AssertPresentationAction(
+    "9. 2 to move to the next heading",
+    ["BRAILLE LINE:  'Wrapping to top.'",
+     "     VISIBLE:  'Wrapping to top.', cursor=0",
      "BRAILLE LINE:  'First Heading h2'",
      "     VISIBLE:  'First Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'Wrapping to top.' voice=system",
      "SPEECH OUTPUT: 'First Heading '",
      "SPEECH OUTPUT: 'link'",
      "SPEECH OUTPUT: 'heading level 2'"]))


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