summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authordobey <dobey>2006-08-18 19:30:25 +0000
committerdobey <dobey>2006-08-18 19:30:25 +0000
commit9ebbf6dc3ba21786c31a02fcb282d3dfaa6e07c5 (patch)
tree2b361c61b7c265871a8b89d3815ac7f48955f28c /python
Initial revision
Diffstat (limited to 'python')
-rw-r--r--python/.cvsignore10
-rw-r--r--python/A11yTestUtils.py106
-rw-r--r--python/Makefile.am9
3 files changed, 125 insertions, 0 deletions
diff --git a/python/.cvsignore b/python/.cvsignore
new file mode 100644
index 0000000..2ca835d
--- /dev/null
+++ b/python/.cvsignore
@@ -0,0 +1,10 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.la
+*.lo
+*.o
+*.pyc
+*.pyo
+
diff --git a/python/A11yTestUtils.py b/python/A11yTestUtils.py
new file mode 100644
index 0000000..444fef7
--- /dev/null
+++ b/python/A11yTestUtils.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+
+#############################################################################
+#
+# Accessibility Evaluation Test Utils
+#
+# Author:
+# Rodney Dawes <dobey@novell.com>
+#
+# Copyright 2006 Novell, Inc.
+#
+#############################################################################
+
+from ldtp import *
+from ldtputils import *
+
+f = None;
+
+def __has_label (windowName, componentName):
+ properties = getobjectinfo (windowName, componentName)
+ for prop in properties:
+ if prop == 'label':
+ return 1
+ elif prop == 'label_by':
+ return 1
+ continue
+ return 0
+
+def __has_description (windowName, componentName):
+ properties = getobjectinfo (windowName, componentName)
+ for prop in properties:
+ if prop == 'description':
+ return 1
+ continue
+ return 0
+
+def __print_properties (errorString, windowName, componentName):
+ properties = getobjectinfo (windowName, componentName)
+ f.write ('<td>' + errorString + '</td>\n')
+ f.write ('<td class=\"widgetname\">' + componentName + '</td>\n')
+ propValue = getobjectproperty (windowName, componentName, 'class')
+ f.write ('<td>' + propValue + '</td>\n')
+ propValue = getobjectproperty (windowName, componentName, 'parent')
+ f.write ('<td>' + propValue + '</td>\n')
+
+def a11y_scan_dialog (windowName, closeButton):
+ waittillguiexist (windowName)
+ objlist = getobjectlist (windowName)
+ f.write ('<table summary=\"\">\n')
+ f.write ('<caption>' + windowName + '</caption>')
+ f.write ('<tr>\n')
+ f.write ('<th>Issue</th>')
+ f.write ('<th>Widget</th><th>Widget Class</th><th>Parent Widget</th>\n')
+ f.write ('</tr>')
+ has_label = 0
+ for obj in objlist:
+ if hasstate (windowName, obj, state.FOCUSABLE) == 1:
+ if __has_label (windowName, obj) == 0:
+ f.write ('<tr>\n')
+ __print_properties ('Missing Name', windowName, obj)
+ f.write ('</tr>\n')
+ if __has_description (windowName, obj) == 0:
+ f.write ('<tr>\n')
+ __print_properties ('Missing Description', windowName, obj)
+ f.write ('</tr>\n')
+ f.write ('</table>\n')
+ click (windowName, closeButton)
+
+def a11y_scan_window (windowName):
+ waittillguiexist (windowName)
+ objlist = getobjectlist (windowName)
+ f.write ('<table summary=\"\">\n')
+ f.write ('<caption>' + windowName + '</caption>')
+ f.write ('<tr>\n')
+ f.write ('<th>Issue</th>')
+ f.write ('<th>Widget</th><th>Widget Class</th><th>Parent Widget</th>\n')
+ f.write ('</tr>')
+ has_label = 0
+ for obj in objlist:
+ if hasstate (windowName, obj, state.FOCUSABLE) == 1:
+ if __has_label (windowName, obj) == 0:
+ f.write ('<tr>\n')
+ __print_properties ('Missing Name', windowName, obj)
+ f.write ('</tr>\n')
+ if __has_description (windowName, obj) == 0:
+ f.write ('<tr>\n')
+ __print_properties ('Missing Description', windowName, obj)
+ f.write ('</tr>\n')
+ f.write ('</table>\n')
+
+def a11y_test_init (programName):
+ global f
+ f = open (programName + '.html', 'w')
+ f.write ('<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">')
+ f.write ('<html>\n')
+ f.write ('<head>\n')
+ f.write ('<title>' + programName + ' Accessibility Test Summary</title>\n')
+ f.write ('<style type=\"text/css\">@import url(report.css);</style>')
+ f.write ('</head>\n')
+ f.write ('<body>\n')
+ launchapp (programName, 1)
+
+def a11y_test_shutdown ():
+ f.write ('</body>\n')
+ f.write ('</html>\n')
+ f.close ()
diff --git a/python/Makefile.am b/python/Makefile.am
new file mode 100644
index 0000000..77b028a
--- /dev/null
+++ b/python/Makefile.am
@@ -0,0 +1,9 @@
+
+pythondir = $(libdir)/python/site-packages
+
+python_DATA = A11yTestUtils.py
+
+EXTRA_DIST = $(python_DATA)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in