orca r3631 - in trunk: . src/orca test/keystrokes/firefox



Author: eitani
Date: Mon Feb 25 18:19:02 2008
New Revision: 3631
URL: http://svn.gnome.org/viewvc/orca?rev=3631&view=rev

Log:
* src/orca/Gecko.py: Removed visible-data-changed listener,
and replaced it with a state-changed:focused listener (bug
* test/keystrokes/firefox/doc_tabs.py: Added a document
tab-switching test.


Added:
   trunk/test/keystrokes/firefox/doc_tabs.py
Modified:
   trunk/ChangeLog
   trunk/src/orca/Gecko.py

Modified: trunk/src/orca/Gecko.py
==============================================================================
--- trunk/src/orca/Gecko.py	(original)
+++ trunk/src/orca/Gecko.py	Mon Feb 25 18:19:02 2008
@@ -1985,6 +1985,12 @@
         self._currentLineContents = None
         self._nextLineContents = None
 
+        # Last focused frame. We are only interested in frame focused events
+        # when it is a different frame, so here we store the last frame
+        # that recieved state-changed:focused.
+        #
+        self._currentFrame = None
+
     def getWhereAmI(self):
         """Returns the "where am I" class for this script.
         """
@@ -2511,8 +2517,6 @@
             self.onDocumentLoadComplete
         listeners["document:load-stopped"]                  = \
             self.onDocumentLoadStopped
-        listeners["object:visible-data-changed"]            = \
-            self.onVisibleDataChanged
         listeners["object:state-changed:showing"]           = \
             self.onStateChanged
         listeners["object:state-changed:checked"]           = \
@@ -2525,6 +2529,8 @@
             self.onChildrenChanged
         listeners["object:text-changed:insert"]             = \
             self.onTextInserted
+        listeners["object:state-changed:focused"]           = \
+            self.onStateFocused
 
         # [[[TODO: HACK - WDW we need to accomodate Gecko's incorrect
         # use of underscores instead of dashes until they fix their bug.
@@ -4242,27 +4248,18 @@
 
         default.Script.onStateChanged(self, event)
 
-    def onVisibleDataChanged(self, event):
-        """Called when the visible data of an object changes.
-        We do this to detect when the user switches between
-        the tabs holding different URL pages in the Firefox
-        window."""
-
-        # See if we have a frame who has a document frame.
-        #
-        documentFrame = None
-        if (event.source.getRole() == pyatspi.ROLE_FRAME) \
-            and event.source.getState().contains(pyatspi.STATE_ACTIVE):
-
-            documentFrame = self.getDocumentFrame()
-
-            # If the document frame is busy loading, we won't present
-            # anything to prevent Orca from being too chatty.  We also
-            # don't want to present anything if we're not in the document.
-            #
-            if self._loadingDocumentContent or not self.inDocumentContent():
+    def onStateFocused(self, event):
+        default.Script.onStateChanged(self, event)
+        if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME and \
+               event.detail1:
+            documentFrame = event.source
+            
+            if self._loadingDocumentContent or \
+                   documentFrame == self._currentFrame:
                 return
 
+            self._currentFrame = documentFrame
+            
             braille.displayMessage(documentFrame.name)
             speech.stop()
             speech.speak(

Added: trunk/test/keystrokes/firefox/doc_tabs.py
==============================================================================
--- (empty file)
+++ trunk/test/keystrokes/firefox/doc_tabs.py	Mon Feb 25 18:19:02 2008
@@ -0,0 +1,130 @@
+#!/usr/bin/python
+
+"""Test of document tabs
+"""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+########################################################################
+# We wait for the focus to be on the Firefox window as well as for focus
+# to move to the frame.
+#
+sequence.append(WaitForWindowActivate("Minefield",None))
+
+########################################################################
+# Load the htmlpage.html test page.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus("Location", acc_role=pyatspi.ROLE_ENTRY))
+sequence.append(TypeAction(utils.htmlURLPrefix + "htmlpage.html"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Open a new tab, and load orca wiki.
+#
+sequence.append(KeyComboAction("<Control>t"))
+sequence.append(WaitForFocus("Location", acc_role=pyatspi.ROLE_ENTRY))
+sequence.append(TypeAction(utils.htmlURLPrefix + "orca-wiki.html"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("Orca - GNOME Live!",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Open a new tab, and load bugzilla start page.
+#
+sequence.append(KeyComboAction("<Control>t"))
+sequence.append(WaitForFocus("Location", acc_role=pyatspi.ROLE_ENTRY))
+sequence.append(TypeAction(utils.htmlURLPrefix + "bugzilla_top.html"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("GNOME Bug Tracking System",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Switch to tab one
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Alt>1"))
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Switch to tab two
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Alt>2"))
+sequence.append(WaitForFocus("Orca - GNOME Live!",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Switch to tab three
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Alt>3"))
+sequence.append(WaitForFocus("GNOME Bug Tracking System",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Delete tab three.
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Ctrl>w"))
+sequence.append(WaitForFocus("Orca - GNOME Live!",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Load first tabs url in second tab, have them both identical.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus("Location", acc_role=pyatspi.ROLE_ENTRY))
+sequence.append(TypeAction(utils.htmlURLPrefix + "htmlpage.html"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Switch to tab one
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Alt>1"))
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Switch to tab two
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Alt>2"))
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Delete tab two.
+#
+sequence.append(PauseAction(1000))
+sequence.append(KeyComboAction("<Ctrl>w"))
+sequence.append(WaitForFocus("HTML test page",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Close the demo
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_name="Location", 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.start()



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