forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaceui.livecodescript
More file actions
296 lines (194 loc) · 6.49 KB
/
Copy pathinterfaceui.livecodescript
File metadata and controls
296 lines (194 loc) · 6.49 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
script "CoreInterfaceUI"
/*
Copyright (C) 2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
on TestSetup
if the environment is "command line" then
return "SKIP GUI-only tests"
end if
if the platform is "HTML5" then
return "SKIP bug 16544"
end if
end TestSetup
on TestInterface2
create stack "Test"
set the defaultstack to "Test"
create field "tf"
set the rect of field "tf" to "100,100,200,200"
set the text of field "tf" to "a"
get the formattedRect of char 1 of field "tf"
local tPoint
put (item 1 of it + item 3 of it) div 2 & "," & (item 2 of it + item 4 of it) div 2 into tPoint
click at tPoint
TestAssert "test", the clickChar is "a"
click at "0,0"
TestAssert "test", the clickChar is empty
end TestInterface2
on TestInterface3
create stack "Test"
set the defaultstack to "Test"
create field
set the rect of the last field to 100,100,200,200
set the text of the last field to "a"
get the formattedRect of char 1 of field 1
click at (item 1 of it + item 3 of it) div 2, (item 2 of it + item 4 of it) div 2
TestAssert "test", the clickCharChunk is "char 1 to 1 of field 1"
click at 0,0
TestAssert "test", the clickCharChunk is empty
end TestInterface3
on TestInterface4
create stack "Test"
set the defaultstack to "Test"
create field "tf"
set the rect of field "tf" to 100,100,200,200
set the text of field "tf" to "abcd"
get the formattedRect of char 1 of field "tf"
click at (item 1 of it + item 3 of it) div 2, (item 2 of it + item 4 of it) div 2
TestAssert "test", the clickChunk is "char 1 to 4 of field 1" or the clickChunk is "char 1 to 4 of field 2"
click at 0,0
TestAssert "test", the clickChunk is empty
end TestInterface4
on TestInterface5
create stack "Test"
set the defaultstack to "Test"
create field "tf1"
set the rect of field "tf1" to 100,100,200,200
create stack "Test"
set the defaultstack to "Test"
create field "tf2"
set the rect of field "tf2" to 200,200,300,300
click at the loc of field "tf1"
TestAssert "test", the clickField is "field 1" or the clickField is "field 2"
click at the loc of field "tf2"
TestAssert "test", the clickField is "field 2" or the clickField is "field 3"
click at 0,0
TestAssert "test", the clickField is empty or the clickField is "field 1"
end TestInterface5
on TestInterface6
create stack "Test"
set the defaultstack to "Test"
click at 50,100
TestAssert "test", the clickH is 50
click at 0,0
TestAssert "test", the clickH is 0
end TestInterface6
on TestInterface7
create stack "Test"
set the defaultstack to "Test"
create field "tf"
set the rect of field "tf" to 100,100,200,200
set the text of field "tf" to "abcd"
get the formattedRect of char 1 of field "tf"
click at (item 1 of it + item 3 of it) div 2, (item 2 of it + item 4 of it) div 2
TestAssert "test", the clickLine is "line 1 of field 1" or the clickLine is "line 1 of field 2"
click at 0,0
TestAssert "test", the clickLine is empty or the clickLine is "line 1 of field 1"
end TestInterface7
on TestInterface8
create stack "Test"
open stack "Test"
click at 50,100
TestAssert "test", the clickLoc is "50,100"
click at 0,0
TestAssert "test", the clickLoc is "0,0"
end TestInterface8
on TestInterface9
create stack "Test"
set the defaultstack to "Test"
create field "tf"
set the rect of field "tf" to 100,100,200,200
set the text of field "tf" to "abcdef"
get the formattedRect of word 1 of field "tf"
click at (item 1 of it + item 3 of it) div 2, (item 2 of it + item 4 of it) div 2
TestAssert "test", the clickText is "abcdef"
click at 0,0
TestAssert "test", the clickText is empty
end TestInterface9
on TestInterface10
create stack "Test"
set the defaultstack to "Test"
click at 50,100
TestAssert "test", the clickV is 100
click at 0,0
TestAssert "test", the clickV is 0
end TestInterface10
on TestInterface44
TestAssert "test", the screenname is not empty
if the platform is "win32" then
TestAssert "test", the screenname is "local win32"
else if the platform is "MacOS" then
TestAssert "test", the screenname is "local Mac"
else if the platform is "Linux" then
TestAssert "test", the screenname is ":0.0" or the screenname is ":0"
end if
end TestInterface44
on TestInterface62
create stack "Test"
set the defaultstack to "Test"
create button
set the loc of button 1 to "0,0"
set the script of button 1 to "on mouseDown;set the cClicked of me to true;end mouseDown"
choose pointer tool
click at "0,0"
TestAssert "test", the selectedObject is button 1
choose browse tool
click at "0,0"
TestAssert "test", (the cClicked of button 1)
end TestInterface62
on TestInterface63
create stack "Test"
set the defaultstack to "Test"
create button
set the loc of button 1 to "0,0"
set the script of button 1 to "on mouseDown;set the resizeable of this stack to false;end mouseDown"
click button 1 at "0,0"
TestAssert "test", (the resizeable of this stack is false)
end TestInterface63
on TestBug11799Part1
create stack "Test"
set the defaultstack to "Test"
create field
focus on field 1
-- For some reason focusing doesn't happen until events are processed...
wait 0 seconds with messages
TestAssertBroken "test", the focusedObject is the long id of field 1, "11799"
end TestBug11799Part1
on TestBug11799Part2
create stack "Test"
set the defaultstack to "Test"
create field 1
focus on field 1
-- For some reason focusing doesn't happen until events are processed...
wait 0 seconds with messages
focus on nothing
-- After unfocusing, the card will be focused until events are processed...
-- ... at which point nothing will be.
TestAssertBroken "test", the focusedObject is the long id of this card, "11799"
end TestBug11799Part2
on TestInterface82
create stack "Test"
set the defaultstack to "Test"
create card
create field
push current card
pop card into field 1
TestAssert "test", the text of field 1 is the long id of the current card
end TestInterface82
on TestInterface85
create stack "Test"
set the defaultstack to "Test"
create card
create field
push current card
pop card into field 1
TestAssert "test", field 1 is the long id of the current card
end TestInterface85