on xenial help sign in
fix testApplicationWindow
28d0c9bMichael Zanetti
qml/Stage/ApplicationWindow.qml+4
@@ -197,6 +197,10 @@ FocusScope {
197 id: stateGroup
197 id: stateGroup
198 objectName: "applicationWindowStateGroup"
198 objectName: "applicationWindowStateGroup"
199 states: [
199 states: [
200+ State{
201+ name: "surface"
202+ when: (root.surface && d.surfaceInitialized) || d.hadSurface
203+ },
200 State {
204 State {
201 name: "splash"
205 name: "splash"
202 when: !root.surface && !d.surfaceInitialized && !d.hadSurface
206 when: !root.surface && !d.surfaceInitialized && !d.hadSurface
qml/Stage/WorkspaceSwitcher.qml+1
@@ -130,6 +130,7 @@ UbuntuShape {
130 top: parent.top; topMargin: units.gu(2)
130 top: parent.top; topMargin: units.gu(2)
131 left: parent.left; leftMargin: units.gu(2)
131 left: parent.left; leftMargin: units.gu(2)
132 }
132 }
133+ spacing: units.gu(2)
133
134
134 Repeater {
135 Repeater {
135 model: screensProxy
136 model: screensProxy
tests/qmltests/Stage/tst_ApplicationWindow.qml+10−42
@@ -245,13 +245,12 @@ Rectangle {
245 function test_showSplashUntilAppFullyInit_data() {
245 function test_showSplashUntilAppFullyInit_data() {
246 return [
246 return [
247 {tag: "state=Running then create surface", swapInitOrder: false},
247 {tag: "state=Running then create surface", swapInitOrder: false},
248−
249 {tag: "create surface then state=Running", swapInitOrder: true},
248 {tag: "create surface then state=Running", swapInitOrder: true},
250 ]
249 ]
251 }
250 }
252
251
253 function test_showSplashUntilAppFullyInit() {
252 function test_showSplashUntilAppFullyInit() {
254− verify(stateGroup.state === "splashScreen");
253+ verify(stateGroup.state === "splash");
255
254
256 if (data.swapInitOrder) {
255 if (data.swapInitOrder) {
257 surfaceCheckbox.checked = true;
256 surfaceCheckbox.checked = true;
@@ -259,7 +258,7 @@ Rectangle {
259 setApplicationState(appRunning);
258 setApplicationState(appRunning);
260 }
259 }
261
260
262− verify(stateGroup.state === "splashScreen");
261+ verify(stateGroup.state === "splash");
263
262
264 if (data.swapInitOrder) {
263 if (data.swapInitOrder) {
265 setApplicationState(appRunning);
264 setApplicationState(appRunning);
@@ -284,27 +283,8 @@ Rectangle {
284 waitUntilTransitionsEnd(stateGroup);
283 waitUntilTransitionsEnd(stateGroup);
285 }
284 }
286
285
287− function test_killedAppShowsScreenshot() {
288− surfaceCheckbox.checked = true;
289− setApplicationState(appRunning);
290− tryCompare(stateGroup, "state", "surface");
291−
292− setApplicationState(appSuspended);
293−
294− verify(stateGroup.state === "surface");
295− verify(fakeApplication.surface !== null);
296−
297− // kill it!
298− surfaceCheckbox.checked = false;
299− setApplicationState(appStopped);
300−
301− tryCompare(stateGroup, "state", "screenshot");
302− tryCompare(fakeApplication.surfaceList, "count", 0);
303− }
304−
305 function test_restartApp() {
286 function test_restartApp() {
306− var screenshotImage = findChild(applicationWindow, "screenshotImage");
287+ tryCompare(stateGroup, "state", "splash");
307−
308 surfaceCheckbox.checked = true;
288 surfaceCheckbox.checked = true;
309 setApplicationState(appRunning);
289 setApplicationState(appRunning);
310 tryCompare(stateGroup, "state", "surface");
290 tryCompare(stateGroup, "state", "surface");
@@ -316,26 +296,23 @@ Rectangle {
316 surfaceCheckbox.checked = false;
296 surfaceCheckbox.checked = false;
317 setApplicationState(appStopped);
297 setApplicationState(appStopped);
318
298
319− tryCompare(stateGroup, "state", "screenshot");
320 waitUntilTransitionsEnd(stateGroup);
299 waitUntilTransitionsEnd(stateGroup);
321− tryCompare(applicationWindow, "surface", null);
300+ tryCompare(stateGroup, "state", "surface");
322
301
323 // and restart it
302 // and restart it
324 setApplicationState(appStarting);
303 setApplicationState(appStarting);
325
304
326 waitUntilTransitionsEnd(stateGroup);
305 waitUntilTransitionsEnd(stateGroup);
327− verify(stateGroup.state === "screenshot");
306+ verify(stateGroup.state === "surface");
328− verify(applicationWindow.surface === null);
329
307
330 setApplicationState(appRunning);
308 setApplicationState(appRunning);
331
309
332 waitUntilTransitionsEnd(stateGroup);
310 waitUntilTransitionsEnd(stateGroup);
333− verify(stateGroup.state === "screenshot");
311+ verify(stateGroup.state === "surface");
334
312
335 surfaceCheckbox.checked = true;
313 surfaceCheckbox.checked = true;
336
314
337 tryCompare(stateGroup, "state", "surface");
315 tryCompare(stateGroup, "state", "surface");
338− tryCompare(screenshotImage, "status", Image.Null);
339 }
316 }
340
317
341 function test_appCrashed() {
318 function test_appCrashed() {
@@ -343,13 +320,15 @@ Rectangle {
343 setApplicationState(appRunning);
320 setApplicationState(appRunning);
344 tryCompare(stateGroup, "state", "surface");
321 tryCompare(stateGroup, "state", "surface");
345 waitUntilTransitionsEnd(stateGroup);
322 waitUntilTransitionsEnd(stateGroup);
323+ var surface = applicationWindow.surface;
346
324
347 // oh, it crashed...
325 // oh, it crashed...
348 surfaceCheckbox.checked = false;
326 surfaceCheckbox.checked = false;
349 setApplicationState(appStopped);
327 setApplicationState(appStopped);
350
328
329+ waitUntilTransitionsEnd(stateGroup);
351− tryCompare(stateGroup, "state", "screenshot");
330+ tryCompare(stateGroup, "state", "surface");
352− tryCompare(applicationWindow, "surface", null);
331+ tryCompare(applicationWindow, "surface", surface);
353 }
332 }
354
333
355 function test_keepSurfaceWhileInvisible() {
334 function test_keepSurfaceWhileInvisible() {
@@ -393,17 +372,6 @@ Rectangle {
393 verify(surfaceItem.touchReleaseCount === 1);
372 verify(surfaceItem.touchReleaseCount === 1);
394 }
373 }
395
374
396− function test_showNothingOnSuddenSurfaceLoss() {
397− surfaceCheckbox.checked = true;
398− setApplicationState(appRunning);
399− tryCompare(stateGroup, "state", "surface");
400− waitUntilTransitionsEnd(stateGroup);
401−
402− applicationWindow.surface = null;
403−
404− tryCompare(stateGroup, "state", "void");
405− }
406−
407 function test_surfaceActiveFocusFollowsAppWindowInterative() {
375 function test_surfaceActiveFocusFollowsAppWindowInterative() {
408 applicationWindow.interactive = false;
376 applicationWindow.interactive = false;
409 applicationWindow.interactive = true;
377 applicationWindow.interactive = true;