@@ -138,6 +138,9 @@ Rectangle {
139 mode: shellLoader.mode
139 mode: shellLoader.mode
140 hasTouchscreen: true
140 hasTouchscreen: true
141+ Component.onCompleted: {
142+ ApplicationManager.startApplication("unity8-dash");
141 Component.onDestruction: {
144 Component.onDestruction: {
142 shellLoader.itemDestroyed = true;
145 shellLoader.itemDestroyed = true;
@@ -598,6 +601,10 @@ Rectangle {
598 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
601 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
599 verify(topLevelSurfaceList);
602 verify(topLevelSurfaceList);
600 stage = findChild(shell, "stage");
603 stage = findChild(shell, "stage");
605+ // wait until unity8-dash is fully loaded
606+ tryCompare(topLevelSurfaceList, "count", 1);
607+ waitUntilAppWindowIsFullyLoaded(topLevelSurfaceList.idAt(0));
603 function loadDesktopShellWithApps() {
610 function loadDesktopShellWithApps() {
@@ -605,7 +612,6 @@ Rectangle {
605 waitForRendering(shell)
612 waitForRendering(shell)
606 shell.usageScenario = "desktop"
613 shell.usageScenario = "desktop"
607 waitForRendering(shell)
614 waitForRendering(shell)
608− var app0 = ApplicationManager.startApplication("unity8-dash")
609 var app1 = ApplicationManager.startApplication("dialer-app")
615 var app1 = ApplicationManager.startApplication("dialer-app")
610 var app2 = ApplicationManager.startApplication("webbrowser-app")
616 var app2 = ApplicationManager.startApplication("webbrowser-app")
611 var app3 = ApplicationManager.startApplication("camera-app")
617 var app3 = ApplicationManager.startApplication("camera-app")
@@ -813,12 +819,6 @@ Rectangle {
814 function swipeAwayGreeter() {
820 function swipeAwayGreeter() {
815 var greeter = findChild(shell, "greeter");
821 var greeter = findChild(shell, "greeter");
817− if (!greeter.shown) {
818− console.log("Greeter not shown. Not swiping.");
822 tryCompare(greeter, "fullyShown", true);
822 tryCompare(greeter, "fullyShown", true);
823 waitForGreeterToStabilize();
823 waitForGreeterToStabilize();
824 removeTimeConstraintsFromSwipeAreas(greeter);
824 removeTimeConstraintsFromSwipeAreas(greeter);
@@ -1245,11 +1245,26 @@ Rectangle {
1246 var wizard = findChild(shell, "wizard");
1246 var wizard = findChild(shell, "wizard");
1247 tryCompare(wizard, "active", true);
1247 tryCompare(wizard, "active", true);
1248+ tryCompareFunction(function() { return topLevelSurfaceList.applicationAt(0).appId; }, "unity8-dash");
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);
1249 tryCompare(topLevelSurfaceList, "count", 0);
1258 tryCompare(topLevelSurfaceList, "count", 0);
1250 compare(wizard.shown, true);
1259 compare(wizard.shown, true);
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);
1252− // And make sure we stop when some surface shows app
1267+ // And make sure we stop when some other surface shows app
1253 var gallerySurfaceId = topLevelSurfaceList.nextId;
1268 var gallerySurfaceId = topLevelSurfaceList.nextId;
1254 var galleryApp = ApplicationManager.startApplication("gallery-app");
1269 var galleryApp = ApplicationManager.startApplication("gallery-app");
1255 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
1270 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
@@ -1299,11 +1314,6 @@ Rectangle {
1299 function test_tapOnRightEdgeReachesApplicationSurface() {
1314 function test_tapOnRightEdgeReachesApplicationSurface() {
1300 loadShell("phone");
1315 loadShell("phone");
1301 swipeAwayGreeter();
1316 swipeAwayGreeter();
1303− var appSurfaceId = topLevelSurfaceList.nextId;
1304− var app = ApplicationManager.startApplication("unity8-dash")
1305− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1307 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1317 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1308 verify(topmostSpreadDelegate);
1318 verify(topmostSpreadDelegate);
@@ -1333,11 +1343,6 @@ Rectangle {
1333 function test_rightEdgeDragDoesNotReachApplicationSurface() {
1343 function test_rightEdgeDragDoesNotReachApplicationSurface() {
1334 loadShell("phone");
1344 loadShell("phone");
1335 swipeAwayGreeter();
1345 swipeAwayGreeter();
1337− var appSurfaceId = topLevelSurfaceList.nextId;
1338− var app = ApplicationManager.startApplication("unity8-dash")
1339− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1341 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1346 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1342 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
1347 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
1343 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
1348 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
@@ -1390,15 +1395,15 @@ Rectangle {
1390 verify(coverPage.shown);
1395 verify(coverPage.shown);
1393− function test_physicalHomeKeyPressOpensDrawer() {
1398+ function test_physicalHomeKeyPressFocusesDash() {
1394 loadShell("phone");
1399 loadShell("phone");
1395− swipeAwayGreeter();
1400+
1401+ var galleryApp = ApplicationManager.startApplication("gallery-app");
1402+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
1397 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
1404 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
1398 windowInputMonitor.homeKeyActivated();
1405 windowInputMonitor.homeKeyActivated();
1399−
1406+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1400− var launcher = findChild(shell, "launcher");
1401− tryCompare(launcher, "drawerShown", true);
1404 function test_tabletLogin_data() {
1409 function test_tabletLogin_data() {
@@ -1517,10 +1522,6 @@ Rectangle {
1517 loadShell("tablet");
1522 loadShell("tablet");
1518 shell.usageScenario = "desktop";
1523 shell.usageScenario = "desktop";
1520− var appSurfaceId = topLevelSurfaceList.nextId;
1521− var app = ApplicationManager.startApplication("unity8-dash")
1522− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1524 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1525 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1525 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1526 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1526 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
1527 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -1545,10 +1546,6 @@ Rectangle {
1545 loadShell("tablet");
1546 loadShell("tablet");
1546 shell.usageScenario = "tablet";
1547 shell.usageScenario = "tablet";
1548− var appSurfaceId = topLevelSurfaceList.nextId;
1549− var app = ApplicationManager.startApplication("unity8-dash")
1550− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1552 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1549 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1553 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1550 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1554 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
1551 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -2441,7 +2438,7 @@ Rectangle {
2442 tryCompare(broadcastUrlSpy, "count", 1);
2439 tryCompare(broadcastUrlSpy, "count", 1);
2443 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2440 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2444− compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2441+ compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2446 var coverPage = findChild(shell, "coverPage");
2443 var coverPage = findChild(shell, "coverPage");
2447 tryCompare(coverPage, "showProgress", 0);
2444 tryCompare(coverPage, "showProgress", 0);
@@ -2482,7 +2479,7 @@ Rectangle {
2483 tryCompare(broadcastUrlSpy, "count", 1);
2480 tryCompare(broadcastUrlSpy, "count", 1);
2484 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2481 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2485− compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2482+ compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2487 var coverPage = findChild(shell, "coverPage");
2484 var coverPage = findChild(shell, "coverPage");
2488 tryCompare(coverPage, "showProgress", 0);
2485 tryCompare(coverPage, "showProgress", 0);
@@ -2711,10 +2708,6 @@ Rectangle {
2711 ensureInputMethodSurface();
2708 ensureInputMethodSurface();
2712 shell.oskEnabled = data.oskEnabled;
2709 shell.oskEnabled = data.oskEnabled;
2714− var appSurfaceId = topLevelSurfaceList.nextId;
2715− var app = ApplicationManager.startApplication("unity8-dash")
2716− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2718 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
2711 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
2719 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
2712 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
2720 var appRepeater = findChild(shell, "appRepeater");
2713 var appRepeater = findChild(shell, "appRepeater");
@@ -2987,11 +2980,7 @@ Rectangle {
2987 swipeAwayGreeter();
2980 swipeAwayGreeter();
2989 var appSurfaceId = topLevelSurfaceList.nextId;
2982 var appSurfaceId = topLevelSurfaceList.nextId;
2990− var app = ApplicationManager.startApplication("unity8-dash")
2983+ var app = ApplicationManager.startApplication("dialer-app")
2991− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2993− appSurfaceId = topLevelSurfaceList.nextId;
2994− app = ApplicationManager.startApplication("dialer-app")
2995 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2984 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2997 appSurfaceId = topLevelSurfaceList.nextId;
2986 appSurfaceId = topLevelSurfaceList.nextId;
@@ -3018,6 +3007,12 @@ Rectangle {
3018 // Now the dash should be highlighted
3007 // Now the dash should be highlighted
3019 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
3008 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
3010+ keyClick(Qt.Key_Q);
3012+ // Dash is not closeable, should still be 2
3013+ tryCompare(ApplicationManager, "count", 2);
3015+ // Move to the next one, should be closable again
3021 keyClick(Qt.Key_Tab);
3016 keyClick(Qt.Key_Tab);
3022 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
3017 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
@@ -3204,10 +3199,6 @@ Rectangle {
3204 waitForRendering(shell);
3199 waitForRendering(shell);
3205 swipeAwayGreeter();
3200 swipeAwayGreeter();
3207− var appSurfaceId = topLevelSurfaceList.nextId;
3208− var app = ApplicationManager.startApplication("unity8-dash")
3209− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
3211 var appDelegate = startApplication("music-app")
3202 var appDelegate = startApplication("music-app")
3212 verify(appDelegate);
3203 verify(appDelegate);
3213 waitForRendering(shell);
3204 waitForRendering(shell);