@@ -55,14 +55,19 @@ on TestGoCardUnquotedName
5555end TestGoCardUnquotedName
5656
5757local sStackFileName
58- command _TestCreateStack pBinary
58+ command _TestCreateStack pBinary, pVisible
5959 local tStack
6060 put "stackToGo" into tStack
6161
6262 if pBinary then
6363 create stack tStack
64+ set the visible of stack tStack to pVisible
6465 else
6566 create script only stack tStack
67+ if pVisible then
68+ put "on preOpenStack" & return & "set the visible of me to" && pVisible & return & "end preOpenStack" into tScript
69+ set the script of stack tStack to tScript
70+ end if
6671 end if
6772
6873 put the tempname into sStackFileName
@@ -78,7 +83,7 @@ end _TestCleanupStack
7883command _TestGoStackUrl pWhich
7984 TestSkipIfNot "write"
8085 local tStack
81- _TestCreateStack pWhich is "binary"
86+ _TestCreateStack pWhich is "binary" , true
8287 put it into tStack
8388 go url ("file:" & sStackFileName )
8489 TestDiagnostic the result
@@ -117,3 +122,75 @@ on TestGoToCard
117122 TestAssert "openCard sent to opened card" , the cOpened of card 1
118123 TestAssert "closeCard sent to closed card" , the cClosed of card 2
119124end TestGoToCard
125+
126+ on _TestGoInvisibleVisibleStack pMode, pWhich, pVisible
127+ TestSkipIfNot "write"
128+ local tStack
129+ _TestCreateStack pWhich is "binary" , pVisible is "visible"
130+ put it into tStack
131+ do "go" && pMode && "stack sStackFilename"
132+ TestDiagnostic the result
133+ if pMode is empty then
134+ put pVisible into pExpectedVisibility
135+ else if pMode is "invisible" and pWhich is "script only" and pVisible is "visible" then
136+ -- a special case:
137+ -- a visible script only stack will be visible even if go invisible
138+ -- is used because the stack becomes visible by a "set the visible..."
139+ -- line in preOpenStack or openStack. So the setting of the visibility
140+ -- by the engine will be overridden when the stack is opened
141+ put "visible" into pExpectedVisibility
142+ else
143+ put pMode into pExpectedVisibility
144+ end if
145+ TestAssert "go" && pMode && "on a" && pVisible && pWhich && "stack opened" , there is a stack tStack
146+ TestAssert "go" && pMode && "on a" && pVisible && pWhich && "stack is" && pExpectedVisibility , the visible of stack tStack is (pExpectedVisibility is "visible" )
147+ _TestCleanupStack
148+ end _TestGoInvisibleVisibleStack
149+
150+ on TestGoVisibleOnVisibleBinary
151+ _TestGoInvisibleVisibleStack "visible" , "binary" , "visible"
152+ end TestGoVisibleOnVisibleBinary
153+
154+ on TestGoVisibleOnInvisibleBinary
155+ _TestGoInvisibleVisibleStack "visible" , "binary" , "invisible"
156+ end TestGoVisibleOnInvisibleBinary
157+
158+ on TestGoVisibleOnVisibleScriptOnly
159+ _TestGoInvisibleVisibleStack "visible" , "script only" , "visible"
160+ end TestGoVisibleOnVisibleScriptOnly
161+
162+ on TestGoVisibleOnInvisibleScriptOnly
163+ _TestGoInvisibleVisibleStack "visible" , "script only" , "invisible"
164+ end TestGoVisibleOnInvisibleScriptOnly
165+
166+ on TestGoInvisibleOnVisibleBinary
167+ _TestGoInvisibleVisibleStack "invisible" , "binary" , "visible"
168+ end TestGoInvisibleOnVisibleBinary
169+
170+ on TestGoInvisibleOnInvisibleBinary
171+ _TestGoInvisibleVisibleStack "invisible" , "binary" , "invisible"
172+ end TestGoInvisibleOnInvisibleBinary
173+
174+ on TestGoInvisibleOnVisibleScriptOnly
175+ _TestGoInvisibleVisibleStack "invisible" , "script only" , "visible"
176+ end TestGoInvisibleOnVisibleScriptOnly
177+
178+ on TestGoInvisibleOnInvisibleScriptOnly
179+ _TestGoInvisibleVisibleStack "invisible" , "script only" , "invisible"
180+ end TestGoInvisibleOnInvisibleScriptOnly
181+
182+ on TestGoRegularOnVisibleBinary
183+ _TestGoInvisibleVisibleStack "" , "binary" , "visible"
184+ end TestGoRegularOnVisibleBinary
185+
186+ on TestGoRegularOnInvisibleBinary
187+ _TestGoInvisibleVisibleStack "" , "binary" , "invisible"
188+ end TestGoRegularOnInvisibleBinary
189+
190+ on TestGoRegularOnVisibleScriptOnly
191+ _TestGoInvisibleVisibleStack "" , "script only" , "visible"
192+ end TestGoRegularOnVisibleScriptOnly
193+
194+ on TestGoRegularOnInvisibleScriptOnly
195+ _TestGoInvisibleVisibleStack "" , "script only" , "invisible"
196+ end TestGoRegularOnInvisibleScriptOnly
0 commit comments