5 from xml.dom import minidom
8 from pasytest import PasyTest as _PasyTest
11 from pyatspi import StateSet
13 os = [pyatspi.STATE_MULTISELECTABLE,
14 pyatspi.STATE_PRESSED,
15 pyatspi.STATE_SHOWING,
16 pyatspi.STATE_TRANSIENT,
17 pyatspi.STATE_COLLAPSED,
18 pyatspi.STATE_EDITABLE,]
20 class StateTest(_PasyTest):
33 def __init__(self, bus, path):
34 _PasyTest.__init__(self, "State", False)
36 def setup(self, test):
39 def test_contains(self, test):
41 if not state.contains(pyatspi.STATE_PRESSED):
42 test.fail("Does not find contained state")
43 if state.contains(pyatspi.STATE_ACTIVE):
44 test.fail("Finds state not contained")
46 def test_add(self, test):
48 state.add(pyatspi.STATE_PRESSED)
49 if not state.contains(pyatspi.STATE_PRESSED):
50 test.fail("State not added")
52 def test_remove(self, test):
54 state.remove(pyatspi.STATE_PRESSED)
55 if state.contains(pyatspi.STATE_PRESSED):
56 test.fail("State not removed")
58 def test_equals(self, test):
61 if not one.equals(two):
62 test.fail("Same states not found equal")
63 two.remove(pyatspi.STATE_PRESSED)
65 test.fail("Unequal states found equal")
67 def test_isEmpty(self, test):
70 test.fail("Empty state found non-empty")
71 emp.add(pyatspi.STATE_PRESSED)
73 test.fail("State incorrectly found empty")
75 def test_compare(self, test):
79 onemtwo = one.compare(two)
80 if not onemtwo.isEmpty():
81 test.fail("Equal states when compared yeilds non-empty state")
83 one.add(pyatspi.STATE_ACTIVE)
84 onemtwo = one.compare(two)
86 act = StateSet(pyatspi.STATE_ACTIVE)
87 if not onemtwo.equals(act):
88 test.fail("Compared states do not yeild correct state")
90 def test_getStates(self, test):
93 states = state.getStates()
97 if not (cone.issubset(ctwo) and ctwo.issubset(cone)):
98 test.fail("States not reported correctly")
100 def teardown(self, test):