From 152823d897f8295a711f7f584d0384b28fb2fcf3 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 18 Apr 2010 15:17:07 +0200 Subject: tc_displayable: test_boundaries fails if you run it more often! --- test/tc_displayable.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/test/tc_displayable.py b/test/tc_displayable.py index 1bbffa73..0d720c2c 100644 --- a/test/tc_displayable.py +++ b/test/tc_displayable.py @@ -113,26 +113,27 @@ class TestDisplayableWithCurses(unittest.TestCase): self.assertRaises(ValueError, disp.resize, -1, 0, hei, wid) self.assertRaises(ValueError, disp.resize, 0, -1, hei, wid) - box = [int(randint(0, hei) * 0.2), 0, - int(randint(0, wid) * 0.2), 0] - box[1] = randint(box[0], hei) - box[1] = randint(box[0], hei) - - def in_box(y, x): - return (x >= box[1] and x < box[1] + box[3]) and \ - (y >= box[0] and y < box[0] + box[2]) - - disp.resize(*box) - for y, x in zip(range(10), range(10)): - is_in_box = in_box(y, x) - - point1 = (y, x) - self.assertEqual(is_in_box, point1 in disp) - - point2 = Fake() - point2.x = x - point2.y = y - self.assertEqual(is_in_box, point2 in disp) + for i in range(1000): + box = [int(randint(0, hei) * 0.2), 0, + int(randint(0, wid) * 0.2), 0] + box[1] = randint(box[0], hei) + box[1] = randint(box[0], hei) + + def in_box(y, x): + return (x >= box[1] and x < box[1] + box[3]) and \ + (y >= box[0] and y < box[0] + box[2]) + + disp.resize(*box) + for y, x in zip(range(10), range(10)): + is_in_box = in_box(y, x) + + point1 = (y, x) + self.assertEqual(is_in_box, point1 in disp) + + point2 = Fake() + point2.x = x + point2.y = y + self.assertEqual(is_in_box, point2 in disp) def test_click(self): self.disp.click = raise_ok -- cgit 1.4.1-2-gfad0 a1c859352421eaa7232987739ed5e8c79ce3f'>commit diff stats
path: root/cpp/.traces/brace_conversion_and_run
blob: 422c534494e78419cfd6c9034b11ce71826a0c0a (plain) (blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168