[orca] Fix regression from keyboard event refactor



commit 452e9dde458257af5896d652fc296fa95140af45
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Apr 21 01:48:02 2016 -0400

    Fix regression from keyboard event refactor

 src/orca/input_event.py                         |   30 ++++++++++++++++-----
 test/keystrokes/firefox/html_link_where_am_i.py |   32 ++++++----------------
 2 files changed, 32 insertions(+), 30 deletions(-)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index 8ffad94..c2eb841 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -29,6 +29,7 @@ __license__   = "LGPL"
 
 import pyatspi
 import time
+from gi.repository import GLib
 
 from . import debug
 from . import keybindings
@@ -568,8 +569,6 @@ class KeyboardEvent(InputEvent):
         msg = '\nvvvvv PROCESS %s: %s vvvvv' % (self.type.value_name.upper(), data)
         debug.println(debug.LEVEL_INFO, msg, False)
 
-        self._did_consume, self._result_reason = self._process()
-
         msg = 'HOST_APP: %s' % self._app
         debug.println(debug.LEVEL_INFO, msg, True)
 
@@ -582,6 +581,8 @@ class KeyboardEvent(InputEvent):
         msg = 'CONSUME:  %s (%s)' % (self._should_consume, self._consume_reason)
         debug.println(debug.LEVEL_INFO, msg, True)
 
+        self._did_consume, self._result_reason = self._process()
+
         if self._should_consume != self._did_consume:
             msg = 'CONSUMED: %s (%s)' % (self._did_consume, self._result_reason)
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -629,15 +630,30 @@ class KeyboardEvent(InputEvent):
         if not (self._consumer or self._handler):
             return False, 'No consumer or handler'
 
+        if self._consumer or self._handler.function:
+            GLib.timeout_add(1, self._consume)
+            return True, 'Will be consumed'
+
+        return False, 'Unaddressed case'
+
+    def _consume(self):
+        startTime = time.time()
+        data = "'%s' (%d)" % (self.event_string, self.hw_code)
+        msg = 'vvvvv CONSUME %s: %s vvvvv' % (self.type.value_name.upper(), data)
+        debug.println(debug.LEVEL_INFO, msg, False)
+
         if self._consumer:
             self._consumer(self)
-            return True, 'Consumed by consumer'
-
-        if self._should_consume and self._handler.function:
+        elif self._handler.function:
             self._handler.function(self._script, self)
-            return True, 'Consumed by handler'
 
-        return False, 'Unaddressed case'
+        msg = 'TOTAL PROCESSING TIME: %.4f' % (time.time() - startTime)
+        debug.println(debug.LEVEL_INFO, msg, True)
+
+        msg = '^^^^^ CONSUME %s: %s ^^^^^' % (self.type.value_name.upper(), data)
+        debug.println(debug.LEVEL_INFO, msg, False)
+
+        return False
 
 class BrailleEvent(InputEvent):
 
diff --git a/test/keystrokes/firefox/html_link_where_am_i.py b/test/keystrokes/firefox/html_link_where_am_i.py
index b104890..6ac6e74 100644
--- a/test/keystrokes/firefox/html_link_where_am_i.py
+++ b/test/keystrokes/firefox/html_link_where_am_i.py
@@ -32,10 +32,7 @@ sequence.append(utils.AssertPresentationAction(
      "SPEECH OUTPUT: 'http link Product summary.'",
      "SPEECH OUTPUT: 'different site.'"]))
 
-# This should time out because there shouldn't be a doc load.
-sequence.append(WaitForDocLoad())
 sequence.append(PauseAction(5000))
-
 sequence.append(KeyComboAction("<Control>Home"))
 sequence.append(KeyComboAction("Tab"))
 
@@ -45,31 +42,20 @@ sequence.append(KeyComboAction("KP_Enter"))
 sequence.append(KeyReleaseAction(0, None, "KP_Insert"))
 sequence.append(utils.AssertPresentationAction(
     "3. Title bar",
-    ["KNOWN ISSUE: There seems to be some input event bleed through here",
-     "BRAILLE LINE:  'Choose the classification - Nightly'",
-     "     VISIBLE:  'Choose the classification - Nigh', cursor=0",
-     "SPEECH OUTPUT: 'Choose the classification - Nightly'"]))
+    ["BRAILLE LINE:  'GNOME Bug Tracking System - Nightly'",
+     "     VISIBLE:  'GNOME Bug Tracking System - Nigh', cursor=0",
+     "SPEECH OUTPUT: 'GNOME Bug Tracking System - Nightly'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("KP_Enter"))
 sequence.append(utils.AssertPresentationAction(
     "4. Where Am I on what should be the New bug link",
-    ["KNOWN ISSUE: There seems to be some input event bleed through here",
-     "BRAILLE LINE:  'Home'",
-     "     VISIBLE:  'Home', cursor=1",
-     "BRAILLE LINE:  'Home'",
-     "     VISIBLE:  'Home', cursor=1",
-     "BRAILLE LINE:  'Loading.  Please wait.'",
-     "     VISIBLE:  'Loading.  Please wait.', cursor=0",
-     "SPEECH OUTPUT: 'https link Home.'",
-     "SPEECH OUTPUT: 'same site.'",
-     "SPEECH OUTPUT: 'Loading.  Please wait.' voice=system"]))
-
-
-#    ["BRAILLE LINE:  'New bug'",
-#     "     VISIBLE:  'New bug', cursor=1",
-#     "SPEECH OUTPUT: 'http link New bug.'",
-#     "SPEECH OUTPUT: 'different site.'"]))
+    ["BRAILLE LINE:  'New bug'",
+     "     VISIBLE:  'New bug', cursor=1",
+     "BRAILLE LINE:  'New bug'",
+     "     VISIBLE:  'New bug', cursor=1",
+     "SPEECH OUTPUT: 'http link New bug.'",
+     "SPEECH OUTPUT: 'different site.'"]))
 
 sequence.append(utils.AssertionSummaryAction())
 sequence.start()


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