blob: 473b57232eafd192f59004167f8ee6a1682f10d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#! /usr/bin/python
from testutil import *
from gi.repository import Gio, GLib
import os, sys
import pyatspi
from dogtail import tree
from dogtail import utils
from dogtail.procedural import *
def active(widget):
return widget.getState().contains(pyatspi.STATE_ARMED)
def visible(widget):
return widget.getState().contains(pyatspi.STATE_VISIBLE)
init()
try:
app = start()
new_button = app.child('New')
back_button = app.child('Back')
delete_button = app.child('Delete')
select_button = app.child('Select')
done_button = app.child('Cancel')
world_view = app.child('World view')
city_view = app.child('City view')
content_view = app.child('Cities')
milan_icon = content_view.findChild(IsTextEqual('Milan'))
# basic state
assert new_button.showing
assert not back_button.showing
assert not delete_button.showing
assert select_button.showing
assert not done_button.showing
assert world_view.showing
assert content_view.showing
assert not city_view.showing
# selection mode
select_button.click()
assert not new_button.showing
assert not back_button.showing
assert delete_button.showing
assert not delete_button.sensitive
assert not select_button.showing
assert done_button.showing
assert world_view.showing
assert content_view.showing
assert not city_view.showing
# select one
milan_icon.click()
assert delete_button.sensitive
# unselect it
milan_icon.click()
assert not delete_button.sensitive
# back from selection mode
done_button.click()
assert new_button.showing
assert not back_button.showing
assert not delete_button.showing
assert select_button.showing
assert not done_button.showing
assert world_view.showing
assert content_view.showing
assert not city_view.showing
# back into selection mode, delete the only item
select_button.click()
milan_icon.click()
delete_button.click()
assert milan_icon.dead
placeholder = app.child('Add locations').parent
assert placeholder.showing
assert select_button.showing
assert not select_button.sensitive
# reset
reset_settings()
utils.doDelay(1)
milan_icon = content_view.findChild(IsTextEqual('Milan'))
assert not milan_icon.dead
# these two should be equivalend to milan_icon.showing,
# but for some reason they aren't
assert visible(milan_icon)
assert milan_icon.parent.showing
finally:
fini()
#type("gimp\n")
#doDelay(2)
#keyCombo("Escape")
|