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()
43 doc = minidom.Document()
45 answer = doc.toprettyxml()
46 correct = os.path.join(testutil.testdata, "object-test-stage1.xml")
49 self.assertEqual(answer, cstring, "Object tree not passed correctly")