@@ -138,9 +138,6 @@ Rectangle {
138138 }
139139 mode: shellLoader.mode
140140 hasTouchscreen: true
141− Component.onCompleted: {
142− ApplicationManager.startApplication("unity8-dash");
143− }
144141 Component.onDestruction: {
145142 shellLoader.itemDestroyed = true;
146143 }
@@ -601,10 +598,6 @@ Rectangle {
601598 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
602599 verify(topLevelSurfaceList);
603600 stage = findChild(shell, "stage");
604−
605− // wait until unity8-dash is fully loaded
606− tryCompare(topLevelSurfaceList, "count", 1);
607− waitUntilAppWindowIsFullyLoaded(topLevelSurfaceList.idAt(0));
608601 }
609602
610603 function loadDesktopShellWithApps() {
@@ -612,6 +605,7 @@ Rectangle {
612605 waitForRendering(shell)
613606 shell.usageScenario = "desktop"
614607 waitForRendering(shell)
608+ var app0 = ApplicationManager.startApplication("unity8-dash")
615609 var app1 = ApplicationManager.startApplication("dialer-app")
616610 var app2 = ApplicationManager.startApplication("webbrowser-app")
617611 var app3 = ApplicationManager.startApplication("camera-app")
@@ -819,6 +813,12 @@ Rectangle {
819813
820814 function swipeAwayGreeter() {
821815 var greeter = findChild(shell, "greeter");
816+
817+ if (!greeter.shown) {
818+ console.log("Greeter not shown. Not swiping.");
819+ return;
820+ }
821+
822822 tryCompare(greeter, "fullyShown", true);
823823 waitForGreeterToStabilize();
824824 removeTimeConstraintsFromSwipeAreas(greeter);
@@ -1245,26 +1245,11 @@ Rectangle {
12451245
12461246 var wizard = findChild(shell, "wizard");
12471247 tryCompare(wizard, "active", true);
1248− tryCompareFunction(function() { return topLevelSurfaceList.applicationAt(0).appId; }, "unity8-dash");
1249−
1250− // Make sure we stay running when there's no top level window (can happen for
1251− // a moment when we restart the dash after switching language)
1252− var dashApplication = ApplicationManager.findApplication("unity8-dash");
1253− ApplicationManager.stopApplication(dashApplication.appId);
1254− // wait until all zombie surfaces are gone. As MirSurfaceItems hold references over them.
1255− // They won't be gone until those surface items are destroyed.
1256− tryCompareFunction(function() { return dashApplication.surfaceList.count }, 0);
12571248
12581249 tryCompare(topLevelSurfaceList, "count", 0);
12591250 compare(wizard.shown, true);
12601251
1261− // And make sure we stay running when dash comes back again
1262− var dashSurfaceId = topLevelSurfaceList.nextId;
1263− ApplicationManager.startApplication(dashApplication.appId);
1264− waitUntilAppWindowIsFullyLoaded(dashSurfaceId);
1265− compare(wizard.shown, true);
1266−
1267− // And make sure we stop when some other surface shows app
1252+ // And make sure we stop when some surface shows app
12681253 var gallerySurfaceId = topLevelSurfaceList.nextId;
12691254 var galleryApp = ApplicationManager.startApplication("gallery-app");
12701255 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
@@ -1314,6 +1299,11 @@ Rectangle {
13141299 function test_tapOnRightEdgeReachesApplicationSurface() {
13151300 loadShell("phone");
13161301 swipeAwayGreeter();
1302+
1303+ var appSurfaceId = topLevelSurfaceList.nextId;
1304+ var app = ApplicationManager.startApplication("unity8-dash")
1305+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1306+
13171307 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
13181308 verify(topmostSpreadDelegate);
13191309
@@ -1343,6 +1333,11 @@ Rectangle {
13431333 function test_rightEdgeDragDoesNotReachApplicationSurface() {
13441334 loadShell("phone");
13451335 swipeAwayGreeter();
1336+
1337+ var appSurfaceId = topLevelSurfaceList.nextId;
1338+ var app = ApplicationManager.startApplication("unity8-dash")
1339+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1340+
13461341 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
13471342 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
13481343 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
@@ -1395,15 +1390,15 @@ Rectangle {
13951390 verify(coverPage.shown);
13961391 }
13971392
1398− function test_physicalHomeKeyPressFocusesDash() {
1393+ function test_physicalHomeKeyPressOpensDrawer() {
13991394 loadShell("phone");
1400−
1401− var galleryApp = ApplicationManager.startApplication("gallery-app");
1402− tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
1395+ swipeAwayGreeter();
14031396
14041397 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
14051398 windowInputMonitor.homeKeyActivated();
1406− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1399+
1400+ var launcher = findChild(shell, "launcher");
1401+ tryCompare(launcher, "drawerShown", true);
14071402 }
14081403
14091404 function test_tabletLogin_data() {
@@ -1522,6 +1517,10 @@ Rectangle {
15221517 loadShell("tablet");
15231518 shell.usageScenario = "desktop";
15241519
1520+ var appSurfaceId = topLevelSurfaceList.nextId;
1521+ var app = ApplicationManager.startApplication("unity8-dash")
1522+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1523+
15251524 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
15261525 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
15271526 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -1546,6 +1545,10 @@ Rectangle {
15461545 loadShell("tablet");
15471546 shell.usageScenario = "tablet";
15481547
1548+ var appSurfaceId = topLevelSurfaceList.nextId;
1549+ var app = ApplicationManager.startApplication("unity8-dash")
1550+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1551+
15491552 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
15501553 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
15511554 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -2438,7 +2441,7 @@ Rectangle {
24382441
24392442 tryCompare(broadcastUrlSpy, "count", 1);
24402443 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2441− compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2444+ compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
24422445
24432446 var coverPage = findChild(shell, "coverPage");
24442447 tryCompare(coverPage, "showProgress", 0);
@@ -2479,7 +2482,7 @@ Rectangle {
24792482
24802483 tryCompare(broadcastUrlSpy, "count", 1);
24812484 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2482− compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2485+ compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
24832486
24842487 var coverPage = findChild(shell, "coverPage");
24852488 tryCompare(coverPage, "showProgress", 0);
@@ -2708,6 +2711,10 @@ Rectangle {
27082711 ensureInputMethodSurface();
27092712 shell.oskEnabled = data.oskEnabled;
27102713
2714+ var appSurfaceId = topLevelSurfaceList.nextId;
2715+ var app = ApplicationManager.startApplication("unity8-dash")
2716+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2717+
27112718 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
27122719 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
27132720 var appRepeater = findChild(shell, "appRepeater");
@@ -2980,7 +2987,11 @@ Rectangle {
29802987 swipeAwayGreeter();
29812988
29822989 var appSurfaceId = topLevelSurfaceList.nextId;
2983− var app = ApplicationManager.startApplication("dialer-app")
2990+ var app = ApplicationManager.startApplication("unity8-dash")
2991+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2992+
2993+ appSurfaceId = topLevelSurfaceList.nextId;
2994+ app = ApplicationManager.startApplication("dialer-app")
29842995 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
29852996
29862997 appSurfaceId = topLevelSurfaceList.nextId;
@@ -3007,12 +3018,6 @@ Rectangle {
30073018 // Now the dash should be highlighted
30083019 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
30093020
3010− keyClick(Qt.Key_Q);
3011−
3012− // Dash is not closeable, should still be 2
3013− tryCompare(ApplicationManager, "count", 2);
3014−
3015− // Move to the next one, should be closable again
30163021 keyClick(Qt.Key_Tab);
30173022 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
30183023
@@ -3199,6 +3204,10 @@ Rectangle {
31993204 waitForRendering(shell);
32003205 swipeAwayGreeter();
32013206
3207+ var appSurfaceId = topLevelSurfaceList.nextId;
3208+ var app = ApplicationManager.startApplication("unity8-dash")
3209+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
3210+
32023211 var appDelegate = startApplication("music-app")
32033212 verify(appDelegate);
32043213 waitForRendering(shell);