orca r4539 - in branches/gnome-2-24: . src/orca/scripts/toolkits/Gecko test/keystrokes/firefox



Author: joanied
Date: Fri Feb 13 20:38:39 2009
New Revision: 4539
URL: http://svn.gnome.org/viewvc/orca?rev=4539&view=rev

Log:
* src/orca/scripts/toolkits/Gecko/script.py:
  test/keystrokes/firefox/bug_568768.py: (new)
  test/keystrokes/firefox/bug_552887a.py:
  Fix for bug #568768 - Orca starts at the top of a newly-loaded
  page rather than the specified fragment.



Added:
   branches/gnome-2-24/test/keystrokes/firefox/bug_568768.py
Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/orca/scripts/toolkits/Gecko/script.py
   branches/gnome-2-24/test/keystrokes/firefox/bug_552887a.py

Modified: branches/gnome-2-24/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- branches/gnome-2-24/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ branches/gnome-2-24/src/orca/scripts/toolkits/Gecko/script.py	Fri Feb 13 20:38:39 2009
@@ -4892,6 +4892,36 @@
 
         return attrs
 
+    def searchForCaretLocation(self, acc):
+        """Attempts to locate the caret on the page independent of our
+        caret context. This functionality is needed when a page loads
+        and the URL is for a fragment (anchor, id, named object) within
+        that page.
+
+        Arguments:
+        - acc: The top-level accessible in which we suspect to find the
+          caret (most likely the document frame).
+
+        Returns the [obj, caretOffset] containing the caret if it can
+        be determined. Otherwise [None, -1] is returned.
+        """
+
+        context = [None, -1]
+        while acc:
+            try:
+                offset = acc.queryText().caretOffset
+            except:
+                acc = None
+            else:
+                context = [acc, offset]
+                childIndex = self.getChildIndex(acc, offset)
+                if childIndex >= 0:
+                    acc = acc[childIndex]
+                else:
+                    break
+
+        return context
+
     def getCaretContext(self, includeNonText=True):
         """Returns the current [obj, caretOffset] if defined.  If not,
         it returns the first [obj, caretOffset] found by an in order
@@ -4909,9 +4939,14 @@
         try:
             return self._documentFrameCaretContext[hash(documentFrame)]
         except:
+            # If we don't have a context, we should attempt to see if we
+            # can find the caret first. Failing that, we'll start at the
+            # top.
+            #
+            [obj, caretOffset] = self.searchForCaretLocation(documentFrame)
             self._documentFrameCaretContext[hash(documentFrame)] = \
-                self.findNextCaretInOrder(None,
-                                          -1,
+                self.findNextCaretInOrder(obj,
+                                          max(-1, caretOffset - 1),
                                           includeNonText)
 
         [obj, caretOffset] = \

Modified: branches/gnome-2-24/test/keystrokes/firefox/bug_552887a.py
==============================================================================
--- branches/gnome-2-24/test/keystrokes/firefox/bug_552887a.py	(original)
+++ branches/gnome-2-24/test/keystrokes/firefox/bug_552887a.py	Fri Feb 13 20:38:39 2009
@@ -31,9 +31,12 @@
 sequence.append(KeyComboAction("<Control>Home"))
 sequence.append(utils.AssertPresentationAction(
     "Top of file",
-    ["BRAILLE LINE:  ''",
+    ["BUG? - In this test, the text is extremely small and probably appears to be on the same line, so we're speaking more than we should be",
+     "BRAILLE LINE:  ''",
      "     VISIBLE:  '', cursor=1",
-     "SPEECH OUTPUT: 'blank'"]))
+     "SPEECH OUTPUT: '",
+     " Line 1",
+     "'"]))
 
 ########################################################################
 # Down Arrow to the bottom.

Added: branches/gnome-2-24/test/keystrokes/firefox/bug_568768.py
==============================================================================
--- (empty file)
+++ branches/gnome-2-24/test/keystrokes/firefox/bug_568768.py	Fri Feb 13 20:38:39 2009
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/python
+
+"""Test of the fix for bug 568768"""
+
+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 + "orca-wiki.html#head-a269540f0f3a25d25e08216f0438ee743a3ebe88"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+########################################################################
+# Down Arrow to the next line, which should be the line after the
+# About heading.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "Line Down",
+    ["BRAILLE LINE:  'Orca is a free, open source, flexible, extensible, and powerful assistive'",
+     "     VISIBLE:  'Orca is a free, open source, fle', cursor=1",
+     "SPEECH OUTPUT: 'Orca is a free, open source, flexible, extensible, and powerful assistive'"]))
+
+########################################################################
+# 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]