[orca] Filter out a spurious, unwanted text-delete event from VTE



commit 26cec79e59d72f9e56dafd0bdad517417303bee1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Aug 24 17:06:47 2016 -0400

    Filter out a spurious, unwanted text-delete event from VTE

 src/orca/scripts/terminal/script.py                |   16 ++++++
 test/keystrokes/gnome-terminal/exit_shell.py       |   51 ++++++++++++++++++++
 test/keystrokes/gnome-terminal/ls.py               |    2 -
 test/keystrokes/gnome-terminal/man_page.py         |    2 -
 .../gnome-terminal/man_page_flat_review.py         |    2 -
 5 files changed, 67 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/scripts/terminal/script.py b/src/orca/scripts/terminal/script.py
index 2e8bd7c..eb00ca5 100644
--- a/src/orca/scripts/terminal/script.py
+++ b/src/orca/scripts/terminal/script.py
@@ -137,3 +137,19 @@ class Script(default.Script):
         voice = self.speechGenerator.voice(string=string)
         speech.speakKeyEvent(event, voice)
         return True
+
+    def skipObjectEvent(self, event):
+        newEvent, newTime = None, 0
+        if event.type == "object:text-changed:delete":
+            newEvent, newTime = self.eventCache.get("object:text-changed:insert")
+
+        if newEvent is None or newEvent.source != event.source:
+            return super().skipObjectEvent(event)
+
+        if event.detail1 != newEvent.detail1:
+            return False
+
+        data = "\n%s%s" % (" " * 11, str(newEvent).replace("\t", " " * 11))
+        msg = "TERMINAL: Skipping due to more recent event at offset%s" % data
+        debug.println(debug.LEVEL_INFO, msg, True)
+        return True
diff --git a/test/keystrokes/gnome-terminal/exit_shell.py b/test/keystrokes/gnome-terminal/exit_shell.py
new file mode 100644
index 0000000..b91d44e
--- /dev/null
+++ b/test/keystrokes/gnome-terminal/exit_shell.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+utils.setClipboardText('PS1="prompt> "')
+
+sequence = MacroSequence()
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Return in old shell",
+    ["BRAILLE LINE:  '$ '",
+     "     VISIBLE:  '$ ', cursor=3",
+     "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(TypeAction("bash"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.StartRecordingAction())
+
+sequence.append(KeyComboAction("<Control><Shift>v"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Return in new shell with changed prompt",
+    ["BRAILLE LINE:  'prompt> '",
+     "     VISIBLE:  'prompt> ', cursor=9",
+     "SPEECH OUTPUT: 'prompt> '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>d"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Ctrl+D to exit new shell",
+    ["BRAILLE LINE:  '$ '",
+     "     VISIBLE:  '$ ', cursor=3",
+     "SPEECH OUTPUT: 'prompt> exit",
+     "$ '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Return in old shell",
+    ["BRAILLE LINE:  '$ '",
+     "     VISIBLE:  '$ ', cursor=3",
+     "SPEECH OUTPUT: '$ '"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
diff --git a/test/keystrokes/gnome-terminal/ls.py b/test/keystrokes/gnome-terminal/ls.py
index 06e08e0..5127d4b 100644
--- a/test/keystrokes/gnome-terminal/ls.py
+++ b/test/keystrokes/gnome-terminal/ls.py
@@ -19,8 +19,6 @@ sequence.append(utils.AssertPresentationAction(
     "1. ls",
     ["BRAILLE LINE:  '$ '",
      "     VISIBLE:  '$ ', cursor=3",
-     "BRAILLE LINE:  '$ '",
-     "     VISIBLE:  '$ ', cursor=3",
      "SPEECH OUTPUT: 'another_test_file_0  another_test_file_4  another_test_file_8",
      "another_test_file_1  another_test_file_5  another_test_file_9",
      "another_test_file_2  another_test_file_6",
diff --git a/test/keystrokes/gnome-terminal/man_page.py b/test/keystrokes/gnome-terminal/man_page.py
index 98ce97e..d423e16 100644
--- a/test/keystrokes/gnome-terminal/man_page.py
+++ b/test/keystrokes/gnome-terminal/man_page.py
@@ -78,8 +78,6 @@ sequence.append(utils.AssertPresentationAction(
     "3. Ctrl+b",
     ["BRAILLE LINE:  ' Manual page orca(1) line 1 (press h for help or q to quit)'",
      "     VISIBLE:  '(press h for help or q to quit)', cursor=32",
-     "BRAILLE LINE:  ' Manual page orca(1) line 1 (press h for help or q to quit)'",
-     "     VISIBLE:  '(press h for help or q to quit)', cursor=32",
      "SPEECH OUTPUT: 'orca(1)                     General Commands Manual                    orca(1)",
      "",
      "NAME",
diff --git a/test/keystrokes/gnome-terminal/man_page_flat_review.py 
b/test/keystrokes/gnome-terminal/man_page_flat_review.py
index c211646..eb262be 100644
--- a/test/keystrokes/gnome-terminal/man_page_flat_review.py
+++ b/test/keystrokes/gnome-terminal/man_page_flat_review.py
@@ -203,8 +203,6 @@ sequence.append(utils.AssertPresentationAction(
      "     VISIBLE:  '(press h for help or q to quit)', cursor=32",
      "BRAILLE LINE:  ' Manual page orca(1) line 1 (press h for help or q to quit)'",
      "     VISIBLE:  '(press h for help or q to quit)', cursor=32",
-     "BRAILLE LINE:  ' Manual page orca(1) line 1 (press h for help or q to quit)'",
-     "     VISIBLE:  '(press h for help or q to quit)', cursor=32",
      "SPEECH OUTPUT: 'orca(1)                     General Commands Manual                    orca(1)",
      "",
      "NAME",


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