forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.livecodescript
More file actions
130 lines (96 loc) · 3.22 KB
/
Copy pathdelete.livecodescript
File metadata and controls
130 lines (96 loc) · 3.22 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
script "CoreInterfaceDelete"
/*
Copyright (C) 2017 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 TestDeleteStackWithSubstack
local tMainstack
create stack
put the short name of it into tMainstack
local tScript
put "on closeStack" into tScript
put return & "local tTarget, tStack" after tScript
put return & "put the long id of the target into tTarget" after tScript
put return & "get wordOffset(" & quote & "stack" & quote & ", tTarget)" after tScript
put return & "put word it to (it + 1) of tTarget into tStack" after tScript
put return & "get the mainstack of stack tStack" after tScript
put return & "end closeStack" after tScript
create stack
set the script of card 1 of it to tScript
set the mainstack of it to tMainstack
delete stack tMainstack
TestAssert "delete stack with substack no crash", true
end TestDeleteStackWithSubstack
on TestDeleteSelectedObjects
create stack
set the defaultStack to the short name of it
create button
create field
select button 1 and field 1
delete
TestAssert "delete selected objects", the number of controls is 0
end TestDeleteSelectedObjects
local sGroup
on TestDeleteSelectedCantDelete
create stack
set the defaultStack to the short name of it
create button
create group
put it into sGroup
create field in sGroup
set the cantDelete of sGroup to true
select button 1
delete
TestAssertThrow "can't delete group with cantDelete true", "__TestDeleteGroup", \
the long id me, "EE_OBJECT_CANTREMOVE"
local tThereIsAGroup
put there is a sGroup into tThereIsAGroup
undo
TestAssert "undo previous delete after failed delete", there is a button 1
end TestDeleteSelectedCantDelete
on __TestDeleteGroup
select sGroup
delete
end __TestDeleteGroup
on TestUndoAfterDeleteNothing
create stack
set the defaultStack to the short name of it
create button
select button 1
delete
select empty
delete
undo
TestAssert "undo previous delete after failed delete", there is a button 1
end TestUndoAfterDeleteNothing
on TestDeleteComboBox
create stack
set the defaultStack to the short name of it
create button
set the style of it to "menu"
set the menumode of it to "combobox"
select it
delete
undo
TestAssert "undo delete of combo box", there is a button 1
end TestDeleteComboBox
on TestDeleteUndoChanged
create stack
set the defaultStack to the short name of it
set the script of this card to \
"on undoChanged; set the cCardReceived of this stack to true; end undoChanged"
create button
set the script of it to \
"on undoChanged; set the cCardReceived of this stack to false; end undoChanged"
select it
delete
TestAssert "undoChanged sent to current card", the cCardReceived of this stack
end TestDeleteUndoChanged