@@ -16,6 +16,114 @@ for more details.
1616You should have received a copy of the GNU General Public License
1717along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1818
19+
20+ on _TestPutBeforeInvalidContainer pContainer
21+ local tDo
22+ put "put" && quote & foo & quote && "before" && pContainer into tDo
23+ do tDo
24+ end _TestPutBeforeInvalidContainer
25+
26+ on _TestPutIntoInvalidContainer pContainer
27+ local tDo
28+ put "put" && quote & foo & quote && "into" && pContainer into tDo
29+ do tDo
30+ end _TestPutIntoInvalidContainer
31+
32+ on _TestPutAfterInvalidContainer pContainer
33+ local tDo
34+ put "put" && quote & foo & quote && "after" && pContainer into tDo
35+ do tDo
36+ end _TestPutAfterInvalidContainer
37+
38+ on TestPutBeforeIntoAfterInvalidContainer
39+
40+ local tCardID , tStackID
41+
42+ create stack "myTestStack"
43+ put it into tStackID
44+
45+ set the defaultstack to tStackID
46+ put the long ID of this card into tCardID
47+
48+
49+ // card
50+ TestAssertThrow "put before invalid container" && tCardID , "_TestPutBeforeInvalidContainer" , the long id of me, \
51+ "EE_CHUNK_SETNOTACONTAINER" , tCardID
52+ TestAssertThrow "put into invalid container" , "_TestPutIntoInvalidContainer" , the long id of me, \
53+ "EE_CHUNK_SETNOTACONTAINER" , tCardID
54+ TestAssertThrow "put after invalid container" , "_TestPutAfterInvalidContainer" , the long id of me, \
55+ "EE_CHUNK_SETNOTACONTAINER" , tCardID
56+
57+ // stack
58+ TestAssertThrow "put before invalid container" && tStackID , "_TestPutBeforeInvalidContainer" , the long id of me, \
59+ "EE_CHUNK_SETNOTACONTAINER" , tStackID
60+ TestAssertThrow "put into invalid container" , "_TestPutIntoInvalidContainer" , the long id of me, \
61+ "EE_CHUNK_SETNOTACONTAINER" , tStackID
62+ TestAssertThrow "put after invalid container" , "_TestPutAfterInvalidContainer" , the long id of me, \
63+ "EE_CHUNK_SETNOTACONTAINER" , tStackID
64+
65+ // widget
66+ local tWidgetID
67+ create widget "myClock" as "com.livecode.widget.clock"
68+ put it into tWidgetID
69+ TestAssertThrow "put before invalid container" && tWidgetID , "_TestPutBeforeInvalidContainer" , the long id of me, \
70+ "EE_CHUNK_SETNOTACONTAINER" , tWidgetID
71+ TestAssertThrow "put into invalid container" , "_TestPutIntoInvalidContainer" , the long id of me, \
72+ "EE_CHUNK_SETNOTACONTAINER" , tWidgetID
73+ TestAssertThrow "put after invalid container" , "_TestPutAfterInvalidContainer" , the long id of me, \
74+ "EE_CHUNK_SETNOTACONTAINER" , tWidgetID
75+
76+
77+ repeat for each item tContainer in "scrollbar,group,player,graphic,eps"
78+ local tID
79+ local tDo
80+ put "create" && tContainer && "myContainer" into tDo
81+ do tDo
82+ put it into tID
83+ TestAssertThrow "put before invalid container:" && tContainer , "_TestPutBeforeInvalidContainer" , the long id of me, \
84+ "EE_CHUNK_SETNOTACONTAINER" , tID
85+ TestAssertThrow "put into invalid container" && tContainer , "_TestPutIntoInvalidContainer" , the long id of me, \
86+ "EE_CHUNK_SETNOTACONTAINER" , tID
87+ TestAssertThrow "put after invalid container" && tContainer , "_TestPutAfterInvalidContainer" , the long id of me, \
88+ "EE_CHUNK_SETNOTACONTAINER" , tID
89+ delete tID
90+ end repeat
91+
92+ delete stack "myTestStack"
93+ end TestPutBeforeIntoAfterInvalidContainer
94+
95+ on TestPutBeforeIntoAfterValidContainer
96+
97+ local tStackID
98+
99+ create stack "myTestStack"
100+ put it into tStackID
101+
102+ set the defaultstack to tStackID
103+
104+ // button case
105+ create button "myNewButton"
106+ put "bar" into button "myNewButton"
107+ put "foo" before button "myNewButton"
108+ put "baz" after button "myNewButton"
109+ TestAssert "Can put before|into|after a button" , the text of button "myNewButton" is "foobarbaz"
110+ delete button "myNewButton"
111+
112+
113+ // image case
114+ repeat for each item tWhere in "before,into,after"
115+ create image "foo"
116+ local tDo
117+ put "put empty" && tWhere && "image" && quote & "foo" & quote into tDo
118+ do tDo
119+ TestAssert "Can put" && tWhere && "an image" , the text of image "foo" is empty
120+ delete image "foo"
121+ end repeat
122+
123+
124+ end TestPutBeforeIntoAfterValidContainer
125+
126+
19127// Test MCVariable::modify variant
20128on TestPutAfterData
21129 local tVar
0 commit comments