on xenial help sign in
fix testshell
commit292cb9797c0dcdb9f1f93fd93f1d16c65db27526 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 4 Apr 2017, 21:05 (10 years ago) parentdfc033c
1 file changed+37−37
tests/qmltests/tst_Shell.qml+37−37
tests/qmltests/tst_Shell.qml+37−37
@@ -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")
@@ -796,6 +790,12 @@ Rectangle {
796790
797791 function swipeAwayGreeter() {
798792 var greeter = findChild(shell, "greeter");
793+
794+ if (!greeter.shown) {
795+ console.log("Greeter not shown. Not swiping.");
796+ return;
797+ }
798+
799799 tryCompare(greeter, "fullyShown", true);
800800 waitForGreeterToStabilize();
801801 removeTimeConstraintsFromSwipeAreas(greeter);
@@ -1222,26 +1222,11 @@ Rectangle {
12221222
12231223 var wizard = findChild(shell, "wizard");
12241224 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);
12341225
12351226 tryCompare(topLevelSurfaceList, "count", 0);
12361227 compare(wizard.shown, true);
12371228
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
12451230 var gallerySurfaceId = topLevelSurfaceList.nextId;
12461231 var galleryApp = ApplicationManager.startApplication("gallery-app");
12471232 waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
@@ -1320,6 +1305,11 @@ Rectangle {
13201305 function test_rightEdgeDragDoesNotReachApplicationSurface() {
13211306 loadShell("phone");
13221307 swipeAwayGreeter();
1308+
1309+ var appSurfaceId = topLevelSurfaceList.nextId;
1310+ var app = ApplicationManager.startApplication("unity8-dash")
1311+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1312+
13231313 var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
13241314 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
13251315 var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
@@ -1372,15 +1362,15 @@ Rectangle {
13721362 verify(coverPage.shown);
13731363 }
13741364
1375− function test_physicalHomeKeyPressFocusesDash() {
1365+ function test_physicalHomeKeyPressOpensDrawer() {
13761366 loadShell("phone");
1377−
1378− var galleryApp = ApplicationManager.startApplication("gallery-app");
1379− tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
1367+ swipeAwayGreeter();
13801368
13811369 var windowInputMonitor = findInvisibleChild(shell, "windowInputMonitor");
13821370 windowInputMonitor.homeKeyActivated();
1383− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1371+
1372+ var launcher = findChild(shell, "launcher");
1373+ tryCompare(launcher, "drawerShown", true);
13841374 }
13851375
13861376 function test_tabletLogin_data() {
@@ -1499,6 +1489,10 @@ Rectangle {
14991489 loadShell("tablet");
15001490 shell.usageScenario = "desktop";
15011491
1492+ var appSurfaceId = topLevelSurfaceList.nextId;
1493+ var app = ApplicationManager.startApplication("unity8-dash")
1494+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1495+
15021496 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
15031497 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
15041498 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -1523,6 +1517,10 @@ Rectangle {
15231517 loadShell("tablet");
15241518 shell.usageScenario = "tablet";
15251519
1520+ var appSurfaceId = topLevelSurfaceList.nextId;
1521+ var app = ApplicationManager.startApplication("unity8-dash")
1522+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1523+
15261524 var webBrowserSurfaceId = topLevelSurfaceList.nextId;
15271525 var webBrowserApp = ApplicationManager.startApplication("webbrowser-app");
15281526 waitUntilAppWindowIsFullyLoaded(webBrowserSurfaceId);
@@ -2415,7 +2413,7 @@ Rectangle {
24152413
24162414 tryCompare(broadcastUrlSpy, "count", 1);
24172415 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
24192417
24202418 var coverPage = findChild(shell, "coverPage");
24212419 tryCompare(coverPage, "showProgress", 0);
@@ -2456,7 +2454,7 @@ Rectangle {
24562454
24572455 tryCompare(broadcastUrlSpy, "count", 1);
24582456 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
24602458
24612459 var coverPage = findChild(shell, "coverPage");
24622460 tryCompare(coverPage, "showProgress", 0);
@@ -2685,6 +2683,10 @@ Rectangle {
26852683 ensureInputMethodSurface();
26862684 shell.oskEnabled = data.oskEnabled;
26872685
2686+ var appSurfaceId = topLevelSurfaceList.nextId;
2687+ var app = ApplicationManager.startApplication("unity8-dash")
2688+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2689+
26882690 var oldOSKState = topLevelSurfaceList.inputMethodSurface.state;
26892691 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
26902692 var appRepeater = findChild(shell, "appRepeater");
@@ -2957,7 +2959,11 @@ Rectangle {
29572959 swipeAwayGreeter();
29582960
29592961 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")
29612967 waitUntilAppWindowIsFullyLoaded(appSurfaceId);
29622968
29632969 appSurfaceId = topLevelSurfaceList.nextId;
@@ -2984,12 +2990,6 @@ Rectangle {
29842990 // Now the dash should be highlighted
29852991 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
29862992
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
29932993 keyClick(Qt.Key_Tab);
29942994 tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
29952995