@@ -158,30 +158,32 @@ Rectangle {
158158 applicationWindowLoader.active = true;
159159 }
160160
161− function test_showSplashUntilAppFullyInit1() {
162− var stateGroup = findInvisibleChild(applicationWindowLoader.item, "applicationWindowStateGroup");
163−
164− verify(stateGroup.state === "splashScreen");
165−
166− setApplicationState(appRunning);
167−
168− verify(stateGroup.state === "splashScreen");
161+ function test_showSplashUntilAppFullyInit_data() {
162+ return [
163+ {tag: "state=Running then create surface", swapInitOrder: false},
169164
170− surfaceCheckbox.checked = true;
171−
172− tryCompare(stateGroup, "state", "surface");
165+ {tag: "create surface then state=Running", swapInitOrder: true},
166+ ]
173167 }
174168
175− function test_showSplashUntilAppFullyInit2() {
169+ function test_showSplashUntilAppFullyInit() {
176170 var stateGroup = findInvisibleChild(applicationWindowLoader.item, "applicationWindowStateGroup");
177171
178172 verify(stateGroup.state === "splashScreen");
179173
180− surfaceCheckbox.checked = true;
174+ if (data.swapInitOrder) {
175+ surfaceCheckbox.checked = true;
176+ } else {
177+ setApplicationState(appRunning);
178+ }
181179
182180 verify(stateGroup.state === "splashScreen");
183181
184− setApplicationState(appRunning);
182+ if (data.swapInitOrder) {
183+ setApplicationState(appRunning);
184+ } else {
185+ surfaceCheckbox.checked = true;
186+ }
185187
186188 tryCompare(stateGroup, "state", "surface");
187189 }
@@ -191,14 +193,16 @@ Rectangle {
191193
192194 surfaceCheckbox.checked = true;
193195 setApplicationState(appRunning);
196+
194197 tryCompare(stateGroup, "state", "surface");
195198
199+ // wait until any transition animation has finished
200+ tryCompare(stateGroup, "transitioning", false, 2000);
201+
196202 setApplicationState(appSuspended);
197203
198− for (var i = 0; i < 10; ++i) {
199− wait(50);
200− verify(stateGroup.state === "surface");
201− }
204+ verify(stateGroup.state === "surface");
205+ verify(stateGroup.transitioning === false);
202206 }
203207
204208 function test_killedAppShowsScreenshot() {
@@ -227,6 +231,7 @@ Rectangle {
227231 surfaceCheckbox.checked = true;
228232 setApplicationState(appRunning);
229233 tryCompare(stateGroup, "state", "surface");
234+ tryCompare(stateGroup, "transitioning", false, 2000);
230235
231236 setApplicationState(appSuspended);
232237
@@ -234,19 +239,20 @@ Rectangle {
234239 setApplicationState(appStopped);
235240
236241 tryCompare(stateGroup, "state", "screenshot");
242+ tryCompare(stateGroup, "transitioning", false, 2000);
237243 tryCompare(fakeApplication, "surface", null);
238244
239245 // and restart it
240246 setApplicationState(appStarting);
241247
242− wait(50);
248+ verify(stateGroup.transitioning === false);
249+ verify(stateGroup.state === "screenshot");
243250 verify(fakeApplication.surface === null);
244− tryCompare(stateGroup, "state", "screenshot");
245251
246252 setApplicationState(appRunning);
247253
248− wait(50);
249− tryCompare(stateGroup, "state", "screenshot");
254+ verify(stateGroup.transitioning === false);
255+ verify(stateGroup.state === "screenshot");
250256
251257 surfaceCheckbox.checked = true;
252258
@@ -260,6 +266,7 @@ Rectangle {
260266 surfaceCheckbox.checked = true;
261267 setApplicationState(appRunning);
262268 tryCompare(stateGroup, "state", "surface");
269+ tryCompare(stateGroup, "transitioning", false, 2000);
263270
264271 // oh, it crashed...
265272 setApplicationState(appStopped);
@@ -274,17 +281,18 @@ Rectangle {
274281 surfaceCheckbox.checked = true;
275282 setApplicationState(appRunning);
276283 tryCompare(stateGroup, "state", "surface");
284+ tryCompare(stateGroup, "transitioning", false, 2000);
277285 verify(fakeApplication.surface !== null);
278286
279287 applicationWindowLoader.item.visible = false;
280288
281− wait(50);
289+ verify(stateGroup.transitioning === false);
282290 verify(stateGroup.state === "surface");
283291 verify(fakeApplication.surface !== null);
284292
285293 applicationWindowLoader.item.visible = true;
286294
287− wait(50);
295+ verify(stateGroup.transitioning === false);
288296 verify(stateGroup.state === "surface");
289297 verify(fakeApplication.surface !== null);
290298 }