[orca] Fix issue getting stuck in visually-hidden MathML content



commit 07364fcfef772c7531be5932894caac404335af8
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 2 17:06:37 2017 +0100

    Fix issue getting stuck in visually-hidden MathML content

 src/orca/scripts/web/script_utilities.py           |    4 +
 test/html/tinymath.html                            |    9 ++
 .../firefox/math_line_nav_tiny_mathml.params       |    1 +
 .../firefox/math_line_nav_tiny_mathml.py           |   88 ++++++++++++++++++++
 4 files changed, 102 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index da94b64..3cddf1a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1287,6 +1287,10 @@ class Utilities(script_utilities.Utilities):
             extents = self.getExtents(firstObj, firstStart, firstEnd)
 
         lastObj, lastStart, lastEnd, lastString = objects[-1]
+        if self.isMathTopLevel(lastObj):
+            lastObj, lastEnd = self.lastContext(lastObj)
+            lastEnd += 1
+
         prevObj, pOffset = self.findPreviousCaretInOrder(firstObj, firstStart)
         nextObj, nOffset = self.findNextCaretInOrder(lastObj, lastEnd - 1)
 
diff --git a/test/html/tinymath.html b/test/html/tinymath.html
index 778ea76..7f17003 100644
--- a/test/html/tinymath.html
+++ b/test/html/tinymath.html
@@ -16,5 +16,14 @@
 Line 2
 </div>
 <div>Line 3</div>
+<div>
+<span role="presentation" style="position: relative;">
+  <span class="tinymath" role="presentation">
+    <div>2+2=</div>
+  </span>
+</span>
+Line 4
+</div>
+<div>Line 5</div>
 </body>
 </html>
diff --git a/test/keystrokes/firefox/math_line_nav_tiny_mathml.params 
b/test/keystrokes/firefox/math_line_nav_tiny_mathml.params
new file mode 100644
index 0000000..9fb2199
--- /dev/null
+++ b/test/keystrokes/firefox/math_line_nav_tiny_mathml.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/tinymath.html
diff --git a/test/keystrokes/firefox/math_line_nav_tiny_mathml.py 
b/test/keystrokes/firefox/math_line_nav_tiny_mathml.py
new file mode 100644
index 0000000..a8de275
--- /dev/null
+++ b/test/keystrokes/firefox/math_line_nav_tiny_mathml.py
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+#sequence.append(WaitForDocLoad())
+sequence.append(PauseAction(5000))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Top of file",
+    ["BRAILLE LINE:  'Line 1'",
+     "     VISIBLE:  'Line 1', cursor=1",
+     "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Line Down",
+    ["BRAILLE LINE:  'math Line 2'",
+     "     VISIBLE:  'math Line 2', cursor=0",
+     "SPEECH OUTPUT: '1 plus 1 equals'",
+     "SPEECH OUTPUT: 'Line 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Line Down",
+    ["BRAILLE LINE:  'Line 3'",
+     "     VISIBLE:  'Line 3', cursor=1",
+     "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Line Down",
+    ["BRAILLE LINE:  '2+2=Line 4'",
+     "     VISIBLE:  '2+2=Line 4', cursor=1",
+     "SPEECH OUTPUT: '2+2='",
+     "SPEECH OUTPUT: 'Line 4'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "5. Line Down",
+    ["BRAILLE LINE:  'Line 5'",
+     "     VISIBLE:  'Line 5', cursor=1",
+     "SPEECH OUTPUT: 'Line 5'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "6. Line Up",
+    ["BRAILLE LINE:  '2+2=Line 4'",
+     "     VISIBLE:  '2+2=Line 4', cursor=1",
+     "SPEECH OUTPUT: '2+2='",
+     "SPEECH OUTPUT: 'Line 4'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "7. Line Up",
+    ["BRAILLE LINE:  'Line 3'",
+     "     VISIBLE:  'Line 3', cursor=1",
+     "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "8. Line Up",
+    ["BRAILLE LINE:  'math Line 2'",
+     "     VISIBLE:  'math Line 2', cursor=0",
+     "SPEECH OUTPUT: '1 plus 1 equals'",
+     "SPEECH OUTPUT: 'Line 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "9. Line Up",
+    ["BRAILLE LINE:  'Line 1'",
+     "     VISIBLE:  'Line 1', cursor=1",
+     "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()


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