[orca] Take hyphens into account when hacking around Gecko text-interface bugs
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Take hyphens into account when hacking around Gecko text-interface bugs
- Date: Sat, 18 Feb 2017 15:44:59 +0000 (UTC)
commit e5d03e9b2f0fda63ee7fdbb27338e3591d10cd05
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Feb 18 10:44:04 2017 -0500
Take hyphens into account when hacking around Gecko text-interface bugs
src/orca/scripts/web/script_utilities.py | 2 +-
test/html/list-with-anchors-and-hyphens.html | 14 +++
.../line_nav_list_with_anchors_and_hyphens.params | 1 +
.../line_nav_list_with_anchors_and_hyphens.py | 90 ++++++++++++++++++++
4 files changed, 106 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index c2129b7..8b9f317 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -860,7 +860,7 @@ class Utilities(script_utilities.Utilities):
if string and boundary in [pyatspi.TEXT_BOUNDARY_SENTENCE_START, None]:
return string, rangeStart, rangeEnd
- words = [m.span() for m in re.finditer("[^\s\ufffc]+", string)]
+ words = [m.span() for m in re.finditer("[^\s\-\ufffc]+", string)]
words = list(map(lambda x: (x[0] + rangeStart, x[1] + rangeStart), words))
if boundary == pyatspi.TEXT_BOUNDARY_WORD_START:
spans = list(filter(_inThisSpan, words))
diff --git a/test/harness/__init__.py b/test/harness/__init__.py
new file mode 100755
index 0000000..e69de29
diff --git a/test/html/list-with-anchors-and-hyphens.html b/test/html/list-with-anchors-and-hyphens.html
new file mode 100644
index 0000000..c47421e
--- /dev/null
+++ b/test/html/list-with-anchors-and-hyphens.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<body>
+ <div style="width:200;">
+ <div>Line 1</div>
+ <dl>
+ <dt><a name="foo" id="foo"></a>Line 2: <strong>Foo</strong>
+ <em>blah-blah-blah-blah-blah</em></dt>
+ <dd><p>blah</p></dd>
+ </dl>
+ <div>Line 3</div>
+ </div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.params
b/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.params
new file mode 100644
index 0000000..92fd562
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/list-with-anchors-and-hyphens.html
diff --git a/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.py
b/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.py
new file mode 100644
index 0000000..b89fa20
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_list_with_anchors_and_hyphens.py
@@ -0,0 +1,90 @@
+#!/usr/bin/python
+
+"""Test of line navigation on a page with multi-line cells and sections."""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+#sequence.append(WaitForDocLoad())
+sequence.append(PauseAction(5000))
+
+# Work around some new quirk in Gecko that causes this test to fail if
+# run via the test harness rather than manually.
+sequence.append(KeyComboAction("<Control>r"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Top of file",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Line Down",
+ ["BRAILLE LINE: 'Line 2: Foo blah-blah-'",
+ " VISIBLE: 'Line 2: Foo blah-blah-', cursor=1",
+ "SPEECH OUTPUT: 'Line 2: Foo blah-blah-.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Line Down",
+ ["BRAILLE LINE: 'blah-blah-blah'",
+ " VISIBLE: 'blah-blah-blah', cursor=1",
+ "SPEECH OUTPUT: 'blah-blah-blah.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "4. Line Down",
+ ["BRAILLE LINE: 'blah'",
+ " VISIBLE: 'blah', cursor=1",
+ "SPEECH OUTPUT: 'blah'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "5. Line Down",
+ ["BRAILLE LINE: 'Line 3'",
+ " VISIBLE: 'Line 3', cursor=1",
+ "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "6. Line Up",
+ ["BRAILLE LINE: 'blah'",
+ " VISIBLE: 'blah', cursor=1",
+ "SPEECH OUTPUT: 'blah'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "7. Line Up",
+ ["BRAILLE LINE: 'blah-blah-blah'",
+ " VISIBLE: 'blah-blah-blah', cursor=1",
+ "SPEECH OUTPUT: 'blah-blah-blah.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "8. Line Up",
+ ["BRAILLE LINE: 'Line 2: Foo blah-blah-'",
+ " VISIBLE: 'Line 2: Foo blah-blah-', cursor=1",
+ "SPEECH OUTPUT: 'Line 2: Foo blah-blah-.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "9. Line Up",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]