on xenial help sign in
fix testApplicationWindow
commit28d0c9b285a3a82be61b3162dfe5d34ba6f1fb8e authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 30 Mar 2017, 11:52 (10 years ago) parent5032e8f
3 files changed+15−42
qml/Stage/ApplicationWindow.qml+4 qml/Stage/WorkspaceSwitcher.qml+1 tests/qmltests/Stage/tst_ApplicationWindow.qml+10−42
qml/Stage/ApplicationWindow.qml+4
@@ -197,6 +197,10 @@ FocusScope {
197197 id: stateGroup
198198 objectName: "applicationWindowStateGroup"
199199 states: [
200+ State{
201+ name: "surface"
202+ when: (root.surface && d.surfaceInitialized) || d.hadSurface
203+ },
200204 State {
201205 name: "splash"
202206 when: !root.surface && !d.surfaceInitialized && !d.hadSurface
qml/Stage/WorkspaceSwitcher.qml+1
@@ -130,6 +130,7 @@ UbuntuShape {
130130 top: parent.top; topMargin: units.gu(2)
131131 left: parent.left; leftMargin: units.gu(2)
132132 }
133+ spacing: units.gu(2)
133134
134135 Repeater {
135136 model: screensProxy
tests/qmltests/Stage/tst_ApplicationWindow.qml+10−42
@@ -245,13 +245,12 @@ Rectangle {
245245 function test_showSplashUntilAppFullyInit_data() {
246246 return [
247247 {tag: "state=Running then create surface", swapInitOrder: false},
248−
249248 {tag: "create surface then state=Running", swapInitOrder: true},
250249 ]
251250 }
252251
253252 function test_showSplashUntilAppFullyInit() {
254− verify(stateGroup.state === "splashScreen");
253+ verify(stateGroup.state === "splash");
255254
256255 if (data.swapInitOrder) {
257256 surfaceCheckbox.checked = true;
@@ -259,7 +258,7 @@ Rectangle {
259258 setApplicationState(appRunning);
260259 }
261260
262− verify(stateGroup.state === "splashScreen");
261+ verify(stateGroup.state === "splash");
263262
264263 if (data.swapInitOrder) {
265264 setApplicationState(appRunning);
@@ -284,27 +283,8 @@ Rectangle {
284283 waitUntilTransitionsEnd(stateGroup);
285284 }
286285
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−
305286 function test_restartApp() {
306− var screenshotImage = findChild(applicationWindow, "screenshotImage");
307−
287+ tryCompare(stateGroup, "state", "splash");
308288 surfaceCheckbox.checked = true;
309289 setApplicationState(appRunning);
310290 tryCompare(stateGroup, "state", "surface");
@@ -316,26 +296,23 @@ Rectangle {
316296 surfaceCheckbox.checked = false;
317297 setApplicationState(appStopped);
318298
319− tryCompare(stateGroup, "state", "screenshot");
320299 waitUntilTransitionsEnd(stateGroup);
321− tryCompare(applicationWindow, "surface", null);
300+ tryCompare(stateGroup, "state", "surface");
322301
323302 // and restart it
324303 setApplicationState(appStarting);
325304
326305 waitUntilTransitionsEnd(stateGroup);
327− verify(stateGroup.state === "screenshot");
328− verify(applicationWindow.surface === null);
306+ verify(stateGroup.state === "surface");
329307
330308 setApplicationState(appRunning);
331309
332310 waitUntilTransitionsEnd(stateGroup);
333− verify(stateGroup.state === "screenshot");
311+ verify(stateGroup.state === "surface");
334312
335313 surfaceCheckbox.checked = true;
336314
337315 tryCompare(stateGroup, "state", "surface");
338− tryCompare(screenshotImage, "status", Image.Null);
339316 }
340317
341318 function test_appCrashed() {
@@ -343,13 +320,15 @@ Rectangle {
343320 setApplicationState(appRunning);
344321 tryCompare(stateGroup, "state", "surface");
345322 waitUntilTransitionsEnd(stateGroup);
323+ var surface = applicationWindow.surface;
346324
347325 // oh, it crashed...
348326 surfaceCheckbox.checked = false;
349327 setApplicationState(appStopped);
350328
351− tryCompare(stateGroup, "state", "screenshot");
352− tryCompare(applicationWindow, "surface", null);
329+ waitUntilTransitionsEnd(stateGroup);
330+ tryCompare(stateGroup, "state", "surface");
331+ tryCompare(applicationWindow, "surface", surface);
353332 }
354333
355334 function test_keepSurfaceWhileInvisible() {
@@ -393,17 +372,6 @@ Rectangle {
393372 verify(surfaceItem.touchReleaseCount === 1);
394373 }
395374
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−
407375 function test_surfaceActiveFocusFollowsAppWindowInterative() {
408376 applicationWindow.interactive = false;
409377 applicationWindow.interactive = true;