7 from dbus.mainloop.glib import DBusGMainLoop
9 from accessible_cache import AccessibleCache
11 from xml.dom import minidom
13 def createNode(accessible, parentElement):
14 e = minidom.Element("accessible")
16 e.attributes["name"] = accessible.name
17 e.attributes["role"] = str(int(accessible.role))
18 e.attributes["description"] = accessible.description
20 for i in range(0, accessible.numChildren):
21 createNode(accessible.getChild(i), e)
23 parentElement.appendChild(e)
25 class AccessibleObjectTestCase(unittest.TestCase):
27 DBusGMainLoop(set_as_default=True)
28 self._app = testutil.runTestApp("libobjectapp.so")
30 self._bus = dbus.SessionBus()
31 self._loop = gobject.MainLoop()
32 self._cache = AccessibleCache(self._bus, testutil.busname, testutil.objectpath)
38 #TODO Shut down the test application.
42 root = self._cache.getRootAccessible()
44 doc = minidom.Document()
46 answer = doc.toprettyxml()
48 correct = os.path.join(testutil.testdata, "object-test-stage1-results.xml")
53 #print ''.join(difflib.unified_diff(answer.splitlines(), cstring.splitlines()))
55 self.assertEqual(answer, cstring, "Object tree not passed correctly")