[orca] Don't treat terminal insertion as command result if terminal isn't locusOfFocus
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Don't treat terminal insertion as command result if terminal isn't locusOfFocus
- Date: Wed, 24 Aug 2016 01:54:18 +0000 (UTC)
commit 65954a3a9d5df20efa6dbabbb061628c5a56f973
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Aug 23 21:51:35 2016 -0400
Don't treat terminal insertion as command result if terminal isn't locusOfFocus
src/orca/scripts/terminal/script_utilities.py | 4 +
test/harness/utils.py | 9 +++
.../gnome-terminal/background_updates.py | 72 ++++++++++++++++++++
test/keystrokes/gnome-terminal/pasting.py | 8 +--
test/keystrokes/gnome-terminal/tab_completion.py | 5 +-
5 files changed, 90 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/terminal/script_utilities.py b/src/orca/scripts/terminal/script_utilities.py
index 1bdcf73..ce37d85 100644
--- a/src/orca/scripts/terminal/script_utilities.py
+++ b/src/orca/scripts/terminal/script_utilities.py
@@ -28,6 +28,7 @@ import pyatspi
from orca import debug
from orca import keybindings
+from orca import orca_state
from orca import script_utilities
from orca import settings_manager
@@ -122,6 +123,9 @@ class Utilities(script_utilities.Utilities):
return False
def treatEventAsCommand(self, event):
+ if event.source != orca_state.locusOfFocus:
+ return False
+
if event.type.startswith("object:text-changed:insert") and event.any_data.strip():
# To let default script handle presentation.
if self.lastInputEventWasPaste():
diff --git a/test/harness/utils.py b/test/harness/utils.py
index 58b0683..10a2f9c 100644
--- a/test/harness/utils.py
+++ b/test/harness/utils.py
@@ -4,8 +4,13 @@ import difflib
import re
import sys
+import gi
+gi.require_version("Gdk", "3.0")
+gi.require_version("Gtk", "3.0")
+
from gi.repository import Gio
from gi.repository import Gdk
+from gi.repository import Gtk
from macaroon.playback import *
testLogger = Gio.DBusProxy.new_for_bus_sync(
@@ -43,6 +48,10 @@ def getKeyCodeForName(name):
return None
+def setClipboardText(text):
+ clipboard = Gtk.Clipboard.get(Gdk.Atom.intern("CLIPBOARD", False))
+ clipboard.set_text(text, -1)
+
class StartRecordingAction(AtomicAction):
'''Tells Orca to log speech and braille output to a string which we
can later obtain and use in an assertion (see AssertPresentationAction)'''
diff --git a/test/keystrokes/gnome-terminal/background_updates.py
b/test/keystrokes/gnome-terminal/background_updates.py
new file mode 100644
index 0000000..bdeb1de
--- /dev/null
+++ b/test/keystrokes/gnome-terminal/background_updates.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+utils.setClipboardText('for i in {0..50}; do echo "Count: $i"; sleep 2; done')
+
+sequence = MacroSequence()
+sequence.append(KeyComboAction("<Control><Shift>v"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(KeyComboAction("<Control><Shift>t"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "1. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "2. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "3. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(KeyComboAction("<Control><Shift>n"))
+sequence.append(PauseAction(2000))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "4. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "5. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(2000))
+sequence.append(utils.AssertPresentationAction(
+ "6. Return",
+ ["BRAILLE LINE: '$ '",
+ " VISIBLE: '$ ', cursor=3",
+ "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
diff --git a/test/keystrokes/gnome-terminal/pasting.py b/test/keystrokes/gnome-terminal/pasting.py
index 7a20377..8257e06 100644
--- a/test/keystrokes/gnome-terminal/pasting.py
+++ b/test/keystrokes/gnome-terminal/pasting.py
@@ -1,15 +1,9 @@
#!/usr/bin/python
-import gi
-gi.require_version("Gdk", "3.0")
-gi.require_version("Gtk", "3.0")
-from gi.repository import Gdk
-from gi.repository import Gtk
from macaroon.playback import *
import utils
-clipboard = Gtk.Clipboard.get(Gdk.Atom.intern("CLIPBOARD", False))
-clipboard.set_text("Hello world", -1)
+utils.setClipboardText("Hello world")
sequence = MacroSequence()
sequence.append(KeyComboAction("Return"))
diff --git a/test/keystrokes/gnome-terminal/tab_completion.py
b/test/keystrokes/gnome-terminal/tab_completion.py
index 2ffcb48..f671d41 100644
--- a/test/keystrokes/gnome-terminal/tab_completion.py
+++ b/test/keystrokes/gnome-terminal/tab_completion.py
@@ -5,6 +5,7 @@ import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
+sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction("cd "))
slash = utils.getKeyCodeForName("slash")
@@ -17,7 +18,9 @@ sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Tab"))
sequence.append(utils.AssertPresentationAction(
"1. Tab to complete 'cd /ho'",
- []))
+ ["BRAILLE LINE: '$ cd /ho'",
+ " VISIBLE: '$ cd /ho', cursor=12",
+ "SPEECH OUTPUT: 'me/'"]))
sequence.append(utils.AssertionSummaryAction())
sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]