on xenial help sign in
fix testshell
292cb97Michael Zanetti
tests/qmltests/tst_Shell.qml+37−37
@@ -138,9 +138,6 @@ Rectangle {
138 }
138 }
139 mode: shellLoader.mode
139 mode: shellLoader.mode
140 hasTouchscreen: true
140 hasTouchscreen: true
141− Component.onCompleted: {
142− ApplicationManager.startApplication("unity8-dash");
143− }
144 Component.onDestruction: {
141 Component.onDestruction: {
145 shellLoader.itemDestroyed = true;
142 shellLoader.itemDestroyed = true;
146 }
143 }
@@ -601,10 +598,6 @@ Rectangle {
601 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
598 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
602 verify(topLevelSurfaceList);
599 verify(topLevelSurfaceList);
603 stage = findChild(shell, "stage");
600 stage = findChild(shell, "stage");
604−
605− // wait until unity8-dash is fully loaded
606− tryCompare(topLevelSurfaceList, "count", 1);
607− waitUntilAppWindowIsFullyLoaded(topLevelSurfaceList.idAt(0));
608 }
601 }
609
602
610 function loadDesktopShellWithApps() {
603 function loadDesktopShellWithApps() {
@@ -612,6 +605,7 @@ Rectangle {
612 waitForRendering(shell)
605 waitForRendering(shell)
613 shell.usageScenario = "desktop"
606 shell.usageScenario = "desktop"
614 waitForRendering(shell)
607 waitForRendering(shell)
608+ var app0 = ApplicationManager.startApplication("unity8-dash")
615 var app1 = ApplicationManager.startApplication("dialer-app")
609 var app1 = ApplicationManager.startApplication("dialer-app")
616 var app2 = ApplicationManager.startApplication("webbrowser-app")
610 var app2 = ApplicationManager.startApplication("webbrowser-app")
617 var app3 = ApplicationManager.startApplication("camera-app")
611 var app3 = ApplicationManager.startApplication("camera-app")
@@ -796,6 +790,12 @@ Rectangle {
796
790
797 function swipeAwayGreeter() {
791 function swipeAwayGreeter() {
798 var greeter = findChild(shell, "greeter");
792 var greeter = findChild(shell, "greeter");
793+
794+ if (!greeter.shown) {
795+ console.log("Greeter not shown. Not swiping.");
796+ return;
797+ }
798+
799 tryCompare(greeter, "fullyShown", true);
799 tryCompare(greeter, "fullyShown", true);
800 waitForGreeterToStabilize();
800 waitForGreeterToStabilize();
801 removeTimeConstraintsFromSwipeAreas(greeter);
801 removeTimeConstraintsFromSwipeAreas(greeter);
@@ -1222,26 +1222,11 @@ Rectangle {
1222
1222
1223 var wizard = findChild(shell, "wizard");
1223 var wizard = findChild(shell, "wizard");
1224 tryCompare(wizard, "active", true);
1224 tryCompare(wizard, "active", true);
1225− tryCompareFunction(function() { return topLevelSurfaceList.applicationAt(0).appId; }, "unity8-dash");
1226−
1227− // Make sure we stay running when there's no top level window (can happen for
1228− // a moment when we restart the dash after switching language)
1229− var dashApplication = ApplicationManager.findApplication("unity8-dash");
1230− ApplicationManager.stopApplication(dashApplication.appId);
1231− // wait until all zombie surfaces are gone. As MirSurfaceItems hold references over them.
1232− // They won't be gone until those surface items are destroyed.
1233− tryCompareFunction(function() { return dashApplication.surfaceList.count }, 0);
1234
1225
1235 tryCompare(topLevelSurfaceList, "count", 0);
1226 tryCompare(topLevelSurfaceList, "count", 0);
1236 compare(wizard.shown, true);
1227 compare(wizard.shown, true);
1237
1228
1238− // And make sure we stay running when dash comes back again
1239− var dashSurfaceId = topLevelSurfaceList.nextId;
1240− ApplicationManager.startApplication(dashApplication.appId);
1241− waitUntilAppWindowIsFullyLoaded(dashSurfaceId);
1242− compare(wizard.shown, true);
1243−
1244− // And make sure we stop when some other surface shows app
1229+ // And make sure we stop when some surface shows app
1245 var gallerySurfaceId = topLevelSurfaceList.nextId;
1230 var gallerySurfaceId = topLevelSurfaceList.nextId;
1246 var galleryApp = ApplicationManager.startApplication("gallery-app");
1231 var galleryApp = ApplicationManager.startApplication("gallery-app");
1247 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
1232 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
@@ -1320,6 +1305,11 @@ Rectangle {
1320 function test_rightEdgeDragDoesNotReachApplicationSurface() {
1305 function test_rightEdgeDragDoesNotReachApplicationSurface() {
1321 loadShell("phone");
1306 loadShell("phone");
1322 swipeAwayGreeter();
1307 swipeAwayGreeter();
1308+
1309+ var appSurfaceId = topLevelSurfaceList.nextId;
1310+ var app = ApplicationManager.startApplication("unity8-dash")
1311+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1312+
1323 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1313 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1324 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
1314 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
1325 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
1315 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
@@ -1372,15 +1362,15 @@ Rectangle {
1372 verify(coverPage.shown);
1362 verify(coverPage.shown);
1373 }
1363 }
1374
1364
1375− function test_physicalHomeKeyPressFocusesDash() {
1365+ function test_physicalHomeKeyPressOpensDrawer() {
1376 loadShell("phone");
1366 loadShell("phone");
1377−
1367+ swipeAwayGreeter();
1378− var galleryApp = ApplicationManager.startApplication("gallery-app");
1379− tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
1380
1368
1381 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
1369 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
1382 windowInputMonitor.homeKeyActivated();
1370 windowInputMonitor.homeKeyActivated();
1383− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1371+
1372+ var launcher = findChild(shell, "launcher");
1373+ tryCompare(launcher, "drawerShown", true);
1384 }
1374 }
1385
1375
1386 function test_tabletLogin_data() {
1376 function test_tabletLogin_data() {
@@ -1499,6 +1489,10 @@ Rectangle {
1499 loadShell("tablet");
1489 loadShell("tablet");
1500 shell.usageScenario = "desktop";
1490 shell.usageScenario = "desktop";
1501
1491
1492+ var appSurfaceId = topLevelSurfaceList.nextId;
1493+ var app = ApplicationManager.startApplication("unity8-dash")
1494+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1495+
1502 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1496 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1503 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1497 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1504 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
1498 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -1523,6 +1517,10 @@ Rectangle {
1523 loadShell("tablet");
1517 loadShell("tablet");
1524 shell.usageScenario = "tablet";
1518 shell.usageScenario = "tablet";
1525
1519
1520+ var appSurfaceId = topLevelSurfaceList.nextId;
1521+ var app = ApplicationManager.startApplication("unity8-dash")
1522+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1523+
1526 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1524 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
1527 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1525 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
1528 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
1526 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -2415,7 +2413,7 @@ Rectangle {
2415
2413
2416 tryCompare(broadcastUrlSpy, "count", 1);
2414 tryCompare(broadcastUrlSpy, "count", 1);
2417 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2415 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2418− compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2416+ compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2419
2417
2420 var coverPage = findChild(shell, "coverPage");
2418 var coverPage = findChild(shell, "coverPage");
2421 tryCompare(coverPage, "showProgress", 0);
2419 tryCompare(coverPage, "showProgress", 0);
@@ -2456,7 +2454,7 @@ Rectangle {
2456
2454
2457 tryCompare(broadcastUrlSpy, "count", 1);
2455 tryCompare(broadcastUrlSpy, "count", 1);
2458 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2456 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2459− compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
2457+ compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2460
2458
2461 var coverPage = findChild(shell, "coverPage");
2459 var coverPage = findChild(shell, "coverPage");
2462 tryCompare(coverPage, "showProgress", 0);
2460 tryCompare(coverPage, "showProgress", 0);
@@ -2685,6 +2683,10 @@ Rectangle {
2685 ensureInputMethodSurface();
2683 ensureInputMethodSurface();
2686 shell.oskEnabled = data.oskEnabled;
2684 shell.oskEnabled = data.oskEnabled;
2687
2685
2686+ var appSurfaceId = topLevelSurfaceList.nextId;
2687+ var app = ApplicationManager.startApplication("unity8-dash")
2688+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2689+
2688 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
2690 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
2689 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
2691 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
2690 var appRepeater = findChild(shell, "appRepeater");
2692 var appRepeater = findChild(shell, "appRepeater");
@@ -2957,7 +2959,11 @@ Rectangle {
2957 swipeAwayGreeter();
2959 swipeAwayGreeter();
2958
2960
2959 var appSurfaceId = topLevelSurfaceList.nextId;
2961 var appSurfaceId = topLevelSurfaceList.nextId;
2960− var app = ApplicationManager.startApplication("dialer-app")
2962+ var app = ApplicationManager.startApplication("unity8-dash")
2963+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2964+
2965+ appSurfaceId = topLevelSurfaceList.nextId;
2966+ app = ApplicationManager.startApplication("dialer-app")
2961 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2967 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2962
2968
2963 appSurfaceId = topLevelSurfaceList.nextId;
2969 appSurfaceId = topLevelSurfaceList.nextId;
@@ -2984,12 +2990,6 @@ Rectangle {
2984 // Now the dash should be highlighted
2990 // Now the dash should be highlighted
2985 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
2991 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
2986
2992
2987− keyClick(Qt.Key_Q);
2988−
2989− // Dash is not closeable, should still be 2
2990− tryCompare(ApplicationManager, "count", 2);
2991−
2992− // Move to the next one, should be closable again
2993 keyClick(Qt.Key_Tab);
2993 keyClick(Qt.Key_Tab);
2994 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
2994 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
2995
2995