[orca] If label inference comes up with nothing, increase left proximity and retry.
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] If label inference comes up with nothing, increase left proximity and retry.
- Date: Wed, 7 Oct 2015 22:58:58 +0000 (UTC)
commit e9df7b26a9845c83163b2110c04a7392ebcd47a2
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Oct 7 18:48:36 2015 -0400
If label inference comes up with nothing, increase left proximity and retry.
src/orca/label_inference.py | 5 ++
test/html/poorly-labeled-form.html | 35 +++++++++++++++++
...el_inference_labels_without_for_far_away.params | 1 +
.../label_inference_labels_without_for_far_away.py | 41 ++++++++++++++++++++
4 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/label_inference.py b/src/orca/label_inference.py
index 69bf78f..a75e062 100644
--- a/src/orca/label_inference.py
+++ b/src/orca/label_inference.py
@@ -94,6 +94,11 @@ class LabelInference:
result = result.strip()
result = result.replace("\n", " ")
+ # Desperate times call for desperate measures....
+ if not result:
+ result, objects = self.inferFromTextLeft(obj, proximity=200)
+ debug.println(debug.LEVEL_FINE, "INFER - Text Left with proximity of 200: %s" % result)
+
self.clearCache()
return result, objects
diff --git a/test/html/poorly-labeled-form.html b/test/html/poorly-labeled-form.html
new file mode 100644
index 0000000..b020b85
--- /dev/null
+++ b/test/html/poorly-labeled-form.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<style>
+div.input label {
+ display: inline-block;
+ width: 160px;
+ margin-bottom: 10px;
+}
+div.input .inputText {
+ width: 200px;
+}
+
+</style>
+</head>
+<body>
+<div>
+<p>Because using the 'for' attribute of labels is just too darned hard....</p>
+ <div>
+ <div class="input">
+ <label>Guess me 1:</label>
+ <input class="inputText" name="username" id="regUsername" type="text">
+ </div>
+ <div class="input">
+ <label>E-mail:</label>
+ <input class="inputText" name="email" id="regEmail" type="text">
+ </div>
+ <div class="input">
+ <label>Secret:</label>
+ <input id="password" class="inputText" name="password" type="password">
+ </div>
+</div>
+</form>
+</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/label_inference_labels_without_for_far_away.params
b/test/keystrokes/firefox/label_inference_labels_without_for_far_away.params
new file mode 100644
index 0000000..5fd808f
--- /dev/null
+++ b/test/keystrokes/firefox/label_inference_labels_without_for_far_away.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/poorly-labeled-form.html
diff --git a/test/keystrokes/firefox/label_inference_labels_without_for_far_away.py
b/test/keystrokes/firefox/label_inference_labels_without_for_far_away.py
new file mode 100644
index 0000000..57543aa
--- /dev/null
+++ b/test/keystrokes/firefox/label_inference_labels_without_for_far_away.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(WaitForDocLoad())
+sequence.append(KeyComboAction("<Control>Home"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Tab",
+ ["BRAILLE LINE: 'Guess me 1: $l'",
+ " VISIBLE: 'Guess me 1: $l', cursor=13",
+ "BRAILLE LINE: 'Focus mode'",
+ " VISIBLE: 'Focus mode', cursor=0",
+ "SPEECH OUTPUT: 'Guess me 1: entry'",
+ "SPEECH OUTPUT: 'Focus mode' voice=system"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Tab",
+ ["BRAILLE LINE: 'Guess me 1: $l'",
+ " VISIBLE: 'Guess me 1: $l', cursor=13",
+ "BRAILLE LINE: 'E-mail: $l'",
+ " VISIBLE: 'E-mail: $l', cursor=9",
+ "SPEECH OUTPUT: 'E-mail: entry'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Tab",
+ ["BRAILLE LINE: 'Secret: $l'",
+ " VISIBLE: 'Secret: $l', cursor=9",
+ "SPEECH OUTPUT: 'Secret: password text'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]