[orca] Fix for bgo#591351 - SayAll document function doesn't work correctly in some webpages



commit 63a05ff70eee8b7753455e122bdf46fe9bcd5a96
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Aug 10 22:18:38 2009 -0400

    Fix for bgo#591351 - SayAll document function doesn't work correctly in some webpages

 src/orca/scripts/toolkits/Gecko/script.py          |    7 ++
 test/html/bug-591351-1.html                        |   10 +++
 test/keystrokes/firefox/sayAll_bug-591351-1.py     |   76 ++++++++++++++++++++
 .../firefox/sayAll_bug-591351-1.settings           |   36 +++++++++
 4 files changed, 129 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 4a05481..d68b7a3 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -5685,6 +5685,13 @@ class Script(default.Script):
             #
             elif role == pyatspi.ROLE_PARAGRAPH and not len(string):
                 string = obj.name
+                # We also see goofiness in some pages. That can cause
+                # SayAll by Sentence to spit up. See bug 591351. So
+                # if we still do not have string and if we've got
+                # more than object in contents, let's dump this one.
+                #
+                if len(contents) > 1 and not len(string):
+                    continue
 
             # If it is a "useless" image (i.e. not a link, no associated
             # text), ignore it, unless it's the only thing here.
diff --git a/test/html/bug-591351-1.html b/test/html/bug-591351-1.html
new file mode 100644
index 0000000..b2f80d5
--- /dev/null
+++ b/test/html/bug-591351-1.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>Pause test</title>
+</head>
+<body>
+Hello world.<br><br><br><bevezeto><p>I wonder what a bevezeto is. I should Google that.</p></bevezeto><br><br><p></p>
+<p><p>Aha! It is the Hungarian word for "Introduction". Here is some <a href="http://translate.google.com/translate_t?hl=en#hu|en|bevezeto">proof</a>. I really think we need to get Attila to teach the Orca team some Hungarian. Maybe one (really easy) phrase per bug comment.</p>
+<p>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/sayAll_bug-591351-1.py b/test/keystrokes/firefox/sayAll_bug-591351-1.py
new file mode 100644
index 0000000..31ab390
--- /dev/null
+++ b/test/keystrokes/firefox/sayAll_bug-591351-1.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/python
+
+"""Test of sayAll output."""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+########################################################################
+# We wait for the focus to be on a blank Firefox window.
+#
+sequence.append(WaitForWindowActivate(utils.firefoxFrameNames, None))
+
+########################################################################
+# Load the local blockquote test case.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction(utils.htmlURLPrefix + "bug-591351-1.html"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+sequence.append(WaitForFocus("Pause test",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+sequence.append(PauseAction(3000))
+
+########################################################################
+# Press Control+Home to move to the top.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+    "Top of file", 
+    ["BRAILLE LINE:  'Hello world.'",
+     "     VISIBLE:  'Hello world.', cursor=1",
+     "SPEECH OUTPUT: 'Hello world.",
+     "'"]))
+
+########################################################################
+# SayAll to the End.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("KP_Add"))
+sequence.append(utils.AssertPresentationAction(
+    "KP_Add to do a SayAll",
+    ["SPEECH OUTPUT: 'Hello world.",
+     "",
+     "",
+     " I wonder what a bevezeto is. I should Google that.",
+     "",
+     " Aha! It is the Hungarian word for \"Introduction\". Here is some proof link . I really think we need to get Attila to teach the Orca team some Hungarian. Maybe one (really easy) phrase per bug comment.'"]))
+
+########################################################################
+# Move to the location bar by pressing Control+L.  When it has focus
+# type "about:blank" and press Return to restore the browser to the
+# conditions at the test's start.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction("about:blank"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+# Just a little extra wait to let some events get through.
+#
+sequence.append(PauseAction(3000))
+
+sequence.append(utils.AssertionSummaryAction())
+
+sequence.start()
diff --git a/test/keystrokes/firefox/sayAll_bug-591351-1.settings b/test/keystrokes/firefox/sayAll_bug-591351-1.settings
new file mode 100644
index 0000000..aaad6aa
--- /dev/null
+++ b/test/keystrokes/firefox/sayAll_bug-591351-1.settings
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+# Default settings for all tests.  These can be overridden by
+# defining a *.params file for a test.  See 
+# http://live.gnome.org/Orca/RegressionTesting for more info.
+
+import re
+
+import orca.debug
+import orca.settings
+
+# This file should be identical to ../../harness/user-settings.py except
+# for the following two lines of executable code:
+#
+orca.settings.sayAllStyle = orca.settings.SAYALL_STYLE_SENTENCE
+orca.settings.enableTutorialMessages = True
+
+orca.settings.enableEchoByWord = False
+orca.settings.enableKeyEcho = False
+orca.settings.enablePrintableKeys = False
+orca.settings.enableModifierKeys = False
+orca.settings.enableLockingKeys = False
+orca.settings.enableFunctionKeys = False
+orca.settings.enableActionKeys = False
+
+orca.settings.enableBraille = False
+orca.settings.enableBrailleMonitor = False
+
+import orca.orca_state
+try:
+    reload(orca.orca_state.orcaCustomizations)
+except AttributeError:
+    try:
+        orca.orca_state.orcaCustomizations = __import__("orca-customizations")
+    except ImportError:
+        pass



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