5 from xml.dom import minidom
8 from pasytest import PasyTest as _PasyTest
12 class ActionTest(_PasyTest):
16 "test_getDescription",
23 def __init__(self, bus, path):
24 _PasyTest.__init__(self, "Action", False)
28 def setup(self, test):
29 self._registry = pyatspi.Registry()
30 self._desktop = self._registry.getDesktop(0)
32 def test_nActions(self, test):
33 root = self._desktop[0]
34 root = root.queryAction()
36 test.assertEqual(nact, 10, "nActions expected %d, recieved %d" % (10, nact))
38 def test_getName(self, test):
39 root = self._desktop[0]
40 root = root.queryAction()
41 name = root.getName(0)
42 test.assertEqual(name, "First action", "Name expected %s, recieved %s" % ("First action", name))
43 name = root.getName(1)
44 test.assertEqual(name, "Action", "Name expected %s, recieved %s" % ("Action", name))
46 def test_getDescription(self, test):
47 root = self._desktop[0]
48 root = root.queryAction()
49 description = root.getDescription(0)
50 expected = "First action performed"
51 test.assertEqual(description, expected, "Description expected %s, recieved %s" % (expected, description))
52 description = root.getDescription(1)
53 expected = "Description of action"
54 test.assertEqual(description, expected, "Description expected %s, recieved %s" % (expected, description))
56 def test_doAction(self, test):
57 root = self._desktop[0]
58 root = root.queryAction()
59 #TODO have event emitted to check action has been performed
60 for i in range(0, root.nActions):
63 def test_getKeyBinding(self, test):
64 root = self._desktop[0]
65 root = root.queryAction()
66 for i in range(0, root.nActions):
67 keybinding = root.getKeyBinding(i)
68 expected = "%s" % (i,)
69 test.assertEqual(keybinding, expected,
70 "Keybinding expected %s, recieved %s" % (expected, keybinding))
72 def teardown(self, test):