[orca] Fix for bgo#591592 - Orca does not speak and braille the appropriate information when moving by head



commit eb0b4e685439c75555d7c4eae9f72a123a7e030c
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Wed Aug 12 18:21:16 2009 -0400

    Fix for bgo#591592 - Orca does not speak and braille the appropriate information when moving by headings on all sites

 .../toolkits/Gecko/structural_navigation.py        |   10 ++-
 test/html/bug-591592.html                          |   18 ++++
 .../firefox/html_struct_nav_bug_591592.py          |   90 ++++++++++++++++++++
 3 files changed, 117 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/structural_navigation.py b/src/orca/scripts/toolkits/Gecko/structural_navigation.py
index 62cb1f9..dccd53f 100644
--- a/src/orca/scripts/toolkits/Gecko/structural_navigation.py
+++ b/src/orca/scripts/toolkits/Gecko/structural_navigation.py
@@ -111,7 +111,15 @@ class GeckoStructuralNavigation(structural_navigation.StructuralNavigation):
         positioned.
         """
 
-        return self._script.findFirstCaretContext(obj, 0)
+        obj, offset = self._script.findFirstCaretContext(obj, 0)
+        # If it's an anchor, look for the first object of use.
+        # See bug #591592.
+        #
+        if obj.getRole() == pyatspi.ROLE_LINK \
+           and not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
+            obj, offset = self._script.findNextCaretInOrder(obj, offset)
+
+        return obj, offset
 
     def _setCaretPosition(self, obj, characterOffset):
         """Sets the caret at the specified offset within obj."""
diff --git a/test/html/bug-591592.html b/test/html/bug-591592.html
new file mode 100644
index 0000000..633bcd1
--- /dev/null
+++ b/test/html/bug-591592.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>Test</title>
+</head>
+<body>
+<h1>This is a test.</h1>
+<h2><a name="HowToAddIPSRepositories-AddingIPSRepositories"></a>Adding IPS Repositories</h2>
+<p>To add an IPS repository to the Package Manager:</p>
+<ol>
+	<li>Select Add from the Repository drop-down menu or select the File &gt; Manage Repositories menu option.</li>
+	<li>Enter a Name that will display in the Repository drop-down menu.</li>
+	<li>Enter the URL of the repository as shown below.</li>
+	<li>Select the Add button.</li>
+</ol>
+<h3><a name="HowToAddIPSRepositories-OtherRepositories"></a>Other Repositories</h3>
+<p><a href="foo" title="Directory of Package Repositories">Directory of Package Repositories</a></p>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/html_struct_nav_bug_591592.py b/test/keystrokes/firefox/html_struct_nav_bug_591592.py
new file mode 100644
index 0000000..86180d7
--- /dev/null
+++ b/test/keystrokes/firefox/html_struct_nav_bug_591592.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/python
+
+"""Test of table structural navigation with headings which contain
+anchors."""
+
+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 blockquote test case.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction(utils.htmlURLPrefix + "bug-591592.html"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+sequence.append(PauseAction(3000))
+
+########################################################################
+# 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. h1'",
+     "     VISIBLE:  'This is a test. h1', cursor=1",
+     "SPEECH OUTPUT: 'This is a test. heading level 1'"]))
+
+########################################################################
+# Press h to move amongst the headings
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+    "1. h",
+    ["BRAILLE LINE:  'Adding IPS Repositories h2'",
+     "     VISIBLE:  'Adding IPS Repositories h2', cursor=1",
+     "SPEECH OUTPUT: 'Adding IPS Repositories heading level 2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+    "2. h",
+    ["BRAILLE LINE:  'Other Repositories h3'",
+     "     VISIBLE:  'Other Repositories h3', cursor=1",
+     "SPEECH OUTPUT: 'Other Repositories heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+    "3. h",
+    ["BRAILLE LINE:  'This is a test. h1'",
+     "     VISIBLE:  'This is a test. h1', cursor=1",
+     "SPEECH OUTPUT: 'Wrapping to top.'",
+     "SPEECH OUTPUT: 'This is a test. heading level 1'"]))
+
+########################################################################
+# 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]