@@ -158,30 +158,32 @@ Rectangle {
158 applicationWindowLoader.active = true;
158 applicationWindowLoader.active = true;
161− function test_showSplashUntilAppFullyInit1() {
161+ function test_showSplashUntilAppFullyInit_data() {
162− var stateGroup = findInvisibleChild(applicationWindowLoader.item, "applicationWindowStateGroup");
162+ return [
163−
163+ {tag: "state=Running then create surface", swapInitOrder: false},
164− verify(stateGroup.state === "splashScreen");
166− setApplicationState(appRunning);
168− verify(stateGroup.state === "splashScreen");
170− surfaceCheckbox.checked = true;
165+ {tag: "create surface then state=Running", swapInitOrder: true},
172− tryCompare(stateGroup, "state", "surface");
175− function test_showSplashUntilAppFullyInit2() {
169+ function test_showSplashUntilAppFullyInit() {
176 var stateGroup = findInvisibleChild(applicationWindowLoader.item, "applicationWindowStateGroup");
170 var stateGroup = findInvisibleChild(applicationWindowLoader.item, "applicationWindowStateGroup");
178 verify(stateGroup.state === "splashScreen");
172 verify(stateGroup.state === "splashScreen");
174+ if (data.swapInitOrder) {
180− surfaceCheckbox.checked = true;
175+ surfaceCheckbox.checked = true;
177+ setApplicationState(appRunning);
182 verify(stateGroup.state === "splashScreen");
180 verify(stateGroup.state === "splashScreen");
182+ if (data.swapInitOrder) {
184− setApplicationState(appRunning);
183+ setApplicationState(appRunning);
185+ surfaceCheckbox.checked = true;
186 tryCompare(stateGroup, "state", "surface");
188 tryCompare(stateGroup, "state", "surface");
@@ -191,14 +193,16 @@ Rectangle {
192 surfaceCheckbox.checked = true;
194 surfaceCheckbox.checked = true;
193 setApplicationState(appRunning);
195 setApplicationState(appRunning);
194 tryCompare(stateGroup, "state", "surface");
197 tryCompare(stateGroup, "state", "surface");
199+ // wait until any transition animation has finished
200+ tryCompare(stateGroup, "transitioning", false, 2000);
196 setApplicationState(appSuspended);
202 setApplicationState(appSuspended);
198− for (var i = 0; i < 10; ++i) {
200− verify(stateGroup.state === "surface");
204+ verify(stateGroup.state === "surface");
201− }
205+ verify(stateGroup.transitioning === false);
204 function test_killedAppShowsScreenshot() {
208 function test_killedAppShowsScreenshot() {
@@ -227,6 +231,7 @@ Rectangle {
227 surfaceCheckbox.checked = true;
231 surfaceCheckbox.checked = true;
228 setApplicationState(appRunning);
232 setApplicationState(appRunning);
229 tryCompare(stateGroup, "state", "surface");
233 tryCompare(stateGroup, "state", "surface");
234+ tryCompare(stateGroup, "transitioning", false, 2000);
231 setApplicationState(appSuspended);
236 setApplicationState(appSuspended);
@@ -234,19 +239,20 @@ Rectangle {
234 setApplicationState(appStopped);
239 setApplicationState(appStopped);
236 tryCompare(stateGroup, "state", "screenshot");
241 tryCompare(stateGroup, "state", "screenshot");
242+ tryCompare(stateGroup, "transitioning", false, 2000);
237 tryCompare(fakeApplication, "surface", null);
243 tryCompare(fakeApplication, "surface", null);
239 // and restart it
245 // and restart it
240 setApplicationState(appStarting);
246 setApplicationState(appStarting);
242− wait(50);
248+ verify(stateGroup.transitioning === false);
249+ verify(stateGroup.state === "screenshot");
243 verify(fakeApplication.surface === null);
250 verify(fakeApplication.surface === null);
244− tryCompare(stateGroup, "state", "screenshot");
246 setApplicationState(appRunning);
252 setApplicationState(appRunning);
248− wait(50);
254+ verify(stateGroup.transitioning === false);
249− tryCompare(stateGroup, "state", "screenshot");
255+ verify(stateGroup.state === "screenshot");
251 surfaceCheckbox.checked = true;
257 surfaceCheckbox.checked = true;
@@ -260,6 +266,7 @@ Rectangle {
260 surfaceCheckbox.checked = true;
266 surfaceCheckbox.checked = true;
261 setApplicationState(appRunning);
267 setApplicationState(appRunning);
262 tryCompare(stateGroup, "state", "surface");
268 tryCompare(stateGroup, "state", "surface");
269+ tryCompare(stateGroup, "transitioning", false, 2000);
264 // oh, it crashed...
271 // oh, it crashed...
265 setApplicationState(appStopped);
272 setApplicationState(appStopped);
@@ -274,17 +281,18 @@ Rectangle {
274 surfaceCheckbox.checked = true;
281 surfaceCheckbox.checked = true;
275 setApplicationState(appRunning);
282 setApplicationState(appRunning);
276 tryCompare(stateGroup, "state", "surface");
283 tryCompare(stateGroup, "state", "surface");
284+ tryCompare(stateGroup, "transitioning", false, 2000);
277 verify(fakeApplication.surface !== null);
285 verify(fakeApplication.surface !== null);
279 applicationWindowLoader.item.visible = false;
287 applicationWindowLoader.item.visible = false;
281− wait(50);
289+ verify(stateGroup.transitioning === false);
282 verify(stateGroup.state === "surface");
290 verify(stateGroup.state === "surface");
283 verify(fakeApplication.surface !== null);
291 verify(fakeApplication.surface !== null);
285 applicationWindowLoader.item.visible = true;
293 applicationWindowLoader.item.visible = true;
287− wait(50);
295+ verify(stateGroup.transitioning === false);
288 verify(stateGroup.state === "surface");
296 verify(stateGroup.state === "surface");
289 verify(fakeApplication.surface !== null);
297 verify(fakeApplication.surface !== null);