orca r3745 - in trunk: . test/harness test/keystrokes/gtk-demo
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r3745 - in trunk: . test/harness test/keystrokes/gtk-demo
- Date: Mon, 24 Mar 2008 16:46:16 +0000 (GMT)
Author: wwalker
Date: Mon Mar 24 16:46:16 2008
New Revision: 3745
URL: http://svn.gnome.org/viewvc/orca?rev=3745&view=rev
Log:
Fix for bug 520656 - The regression test harness should be capable of handling alternative expected results
Modified:
trunk/ChangeLog
trunk/test/harness/utils.py
trunk/test/keystrokes/gtk-demo/debug_commands.py
Modified: trunk/test/harness/utils.py
==============================================================================
--- trunk/test/harness/utils.py (original)
+++ trunk/test/harness/utils.py Mon Mar 24 16:46:16 2008
@@ -10,7 +10,7 @@
DojoURLPrefix="http://bashautomation.com/dojo-release-1.1.0b2/dijit/tests/"
# Where to find our local HTML tests.
#
-import sys, os
+import sys, os, re
wd = os.path.dirname(sys.argv[0])
fullPath = os.path.abspath(wd)
htmlDir = os.path.abspath(fullPath + "/../../html")
@@ -58,13 +58,31 @@
def assertListEquality(rawOrcaResults, expectedList):
'''Convert raw speech and braille output obtained from Orca into a
list by splitting it at newline boundaries. Compare it to the
- list passed in and return the actual results if they differ.'''
+ list passed in and return the actual results if they differ.
+ Otherwise, return None to indicate an equality.'''
results = rawOrcaResults.strip().split("\n")
- if results != expectedList:
- return results
- else:
+
+ # Shoot for a string comparison first.
+ #
+ if results == expectedList:
return None
+ elif len(results) != len(expectedList):
+ return results
+
+ # If the string comparison failed, do a regex match item by item
+ #
+ for i in range(0, len(expectedList)):
+ if results[i] == expectedList[i]:
+ continue
+ else:
+ expectedResultRE = re.compile(expectedList[i])
+ if expectedResultRE.match(results[i]):
+ continue
+ else:
+ return results
+
+ return None
class AssertPresentationAction(AtomicAction):
'''Ask Orca for the speech and braille logged since the last use
@@ -78,7 +96,8 @@
def __init__(self, name, expectedResults,
assertionPredicate=assertListEquality):
'''name: the name of the test
- expectedResults: the results we want (typically a list)
+ expectedResults: the results we want (typically a list of strings
+ that can be treated as regular expressions)
assertionPredicate: method to compare actual results to expected
results
'''
Modified: trunk/test/keystrokes/gtk-demo/debug_commands.py
==============================================================================
--- trunk/test/keystrokes/gtk-demo/debug_commands.py (original)
+++ trunk/test/keystrokes/gtk-demo/debug_commands.py Mon Mar 24 16:46:16 2008
@@ -23,9 +23,9 @@
sequence.append(KeyReleaseAction(0, None, "KP_Insert"))
sequence.append(utils.AssertPresentationAction(
"Report script information",
- ["BRAILLE LINE: 'SCRIPT INFO: Script name='gtk-demo (module=orca.default)' Application name='gtk-demo' Toolkit name='GAIL' Version='1.20.0''",
+ ["BRAILLE LINE: 'SCRIPT INFO: Script name='gtk-demo [(]module=orca.default[)]' Application name='gtk-demo' Toolkit name='GAIL' Version='[0-9]+[.][0-9]+[.][0-9]+''",
" VISIBLE: 'SCRIPT INFO: Script name='gtk-de', cursor=0",
- "SPEECH OUTPUT: 'SCRIPT INFO: Script name='gtk-demo (module=orca.default)' Application name='gtk-demo' Toolkit name='GAIL' Version='1.20.0''"]))
+ "SPEECH OUTPUT: 'SCRIPT INFO: Script name='gtk-demo [(]module=orca.default[)]' Application name='gtk-demo' Toolkit name='GAIL' Version='[0-9]+[.][0-9]+[.][0-9]+''"]))
# Just a little extra wait to let some events get through.
#
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]