5 from xml.dom import minidom
8 from pasytest import PasyTestSuite
10 def createNode(accessible, parentElement):
11 e = minidom.Element("accessible")
13 e.attributes["name"] = accessible.name
14 e.attributes["role"] = str(int(accessible.role))
15 e.attributes["description"] = accessible.description
17 for i in range(0, accessible.numChildren):
18 createNode(accessible.getChild(i), e)
20 parentElement.appendChild(e)
22 class TreeTestSuite(PasyTestSuite):
24 __tests__ = ["accessibleTree"]
26 def __init__(self, bus, name):
27 PasyTestSuite.__init__(self, "Tree")
28 self._cache = getAccessibleCache(bus, name)
30 def accessibleTree(test):
31 root = self._cache.getRootAccessible()
33 doc = minidom.Document()
35 answer = doc.toprettyxml()
37 correct = os.path.join(os.environ["TEST_DATA_DIRECTORY"],
38 "object-test-stage1-results.xml")
42 test.assertEqual(answer, cstring, "Object tree not passed correctly")