[orca] Fix for bug 587794



commit 45445d215a5d24c77b212fb1a9f62d29849898ac
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Jul 9 16:33:54 2009 -0400

    Fix for bug 587794
    
    Fix for bug 587794 - In some pages I cannot read using the Down Arrow key.

 src/orca/scripts/toolkits/Gecko/script.py       |   12 ++-
 test/html/twitter-bug.html                      |   12 +++
 test/keystrokes/firefox/line_nav_twitter_bug.py |  114 +++++++++++++++++++++++
 3 files changed, 136 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 9901a99..37a4878 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -5279,13 +5279,21 @@ class Script(default.Script):
                             offset = start + 1
                         else:
                             # It's a link that ends on our left. Who knows
-                            # where it starts. Might be on the previous
-                            # line.
+                            # where it starts? Might be on the previous
+                            # line. We will assume that it begins on this
+                            # line if the start offset is 0. However, it
+                            # might be an image link which occupies more
+                            # than just this line. To be safe, we'll also
+                            # look to be sure that the text does not start
+                            # with an embedded object character. See bug
+                            # 587794.
                             #
                             cOffset = childText.characterCount - 1
                             [cLine, cStart, cEnd] = \
                                 childText.getTextAtOffset(cOffset, boundary)
                             if cStart == 0 \
+                               and not cLine.startswith(\
+                                self.EMBEDDED_OBJECT_CHARACTER) \
                                and obj.getRole() != pyatspi.ROLE_PANEL:
                                 # It starts on this line.
                                 #
diff --git a/test/html/twitter-bug.html b/test/html/twitter-bug.html
new file mode 100644
index 0000000..8079816
--- /dev/null
+++ b/test/html/twitter-bug.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>Test</title>
+</head>
+<body>
+<p>This is a test.</p>
+<div>
+<h2><a href="foo"><img alt="" border="0" height="73" src="" valign="middle" width="73" /></a>Joanmarie</h2>
+<p>Another test</p>
+</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/line_nav_twitter_bug.py b/test/keystrokes/firefox/line_nav_twitter_bug.py
new file mode 100644
index 0000000..d086496
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_twitter_bug.py
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/python
+
+"""Test of line navigation output of Firefox."""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+########################################################################
+# We wait for the focus to be on a blank Firefox window.
+#
+sequence.append(WaitForWindowActivate(utils.firefoxFrameNames, None))
+
+########################################################################
+# Load the local "simple form" test case.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction(utils.htmlURLPrefix + "twitter-bug.html"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+sequence.append(WaitForFocus("Test",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Press Control+Home to move to the top.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+    "Top of file",
+    ["BRAILLE LINE:  'This is a test.'",
+     "     VISIBLE:  'This is a test.', cursor=1",
+     "SPEECH OUTPUT: 'This is a test.'"]))
+
+########################################################################
+# Down Arrow.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Line Down",
+    ["BRAILLE LINE:  'foo Image h2'",
+     "     VISIBLE:  'foo Image h2', cursor=1",
+     "SPEECH OUTPUT: 'foo link image heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Line Down",
+    ["BRAILLE LINE:  'Joanmarie h2'",
+     "     VISIBLE:  'Joanmarie h2', cursor=1",
+     "SPEECH OUTPUT: 'Joanmarie heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Line Down",
+    ["BRAILLE LINE:  'Another test'",
+     "     VISIBLE:  'Another test', cursor=1",
+     "SPEECH OUTPUT: 'Another test'"]))
+
+########################################################################
+# Up Arrow.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Line Up",
+    ["BRAILLE LINE:  'Joanmarie h2'",
+     "     VISIBLE:  'Joanmarie h2', cursor=1",
+     "SPEECH OUTPUT: 'Joanmarie heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Line Up",
+    ["BRAILLE LINE:  'foo Image h2'",
+     "     VISIBLE:  'foo Image h2', cursor=1",
+     "SPEECH OUTPUT: 'foo link image heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Line Up",
+    ["BRAILLE LINE:  'This is a test.'",
+     "     VISIBLE:  'This is a test.', cursor=1",
+     "SPEECH OUTPUT: 'This is a test.'"]))
+
+########################################################################
+# Move to the location bar by pressing Control+L.  When it has focus
+# type "about:blank" and press Return to restore the browser to the
+# conditions at the test's start.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction("about:blank"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+# Just a little extra wait to let some events get through.
+#
+sequence.append(PauseAction(3000))
+
+sequence.append(utils.AssertionSummaryAction())
+
+sequence.start()



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