@@ -503,39 +503,37 @@ Rectangle {
503 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
503 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
504 loadShell("mako");
504 loadShell("mako");
506− var spreadRepeater = findChild(shell, "spreadRepeater");
506+ var primarySurfaceId = topLevelSurfaceList.nextId;
507− verify(spreadRepeater);
507+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
508−
508+ verify(primaryApp);
509− // unity8-dash supports only primary orientation and should be already running
509+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
510− compare(spreadRepeater.count, 1);
510+
511− var dashDelegate = spreadRepeater.itemAt(0);
511+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
512− var dashApp = dashDelegate.application;
512+ verify(primaryAppWindow)
513− verify(dashApp);
513+ var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
514− compare(dashApp.appId, "unity8-dash");
514+
515− var dashAppWindow = findChild(dashDelegate, "appWindow");
516− verify(dashAppWindow);
517− compare(dashDelegate.focus, true);
515+ compare(primaryDelegate.focus, true);
518− compare(dashApp.rotatesWindowContents, false);
516+ compare(primaryApp.rotatesWindowContents, false);
519− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
517+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
520− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
518+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
522− tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
520+ tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
523− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
521+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
525 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
523 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
526 rotateTo(90);
524 rotateTo(90);
528− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
526+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
529 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
527 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
531 rotateTo(180);
529 rotateTo(180);
533− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
531+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
534 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
532 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
536 rotateTo(270);
534 rotateTo(270);
538− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
536+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
539 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
537 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
@@ -548,37 +546,39 @@ Rectangle {
548 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
546 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
549 loadShell(data.deviceName);
547 loadShell(data.deviceName);
551− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
549+ var primarySurfaceId = topLevelSurfaceList.nextId;
552− var dashSurfaceId = topLevelSurfaceList.idAt(0);
550+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
553− var dashAppWindow = findAppWindowForSurfaceId(dashSurfaceId);
551+ verify(primaryApp);
552+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
555− // unity8-dash supports only primary orientation and should be already running
554+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
555+ verify(primaryAppWindow)
557− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
557+ // primary-oriented-app supports only primary orientation
558− var dashApp = dashAppWindow.application;
560− compare(dashApp.rotatesWindowContents, false);
561− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
562− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
564− tryCompareFunction(function(){return dashApp.surfaceList.count > 0;}, true);
559+ compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
560+ compare(primaryApp.rotatesWindowContents, false);
561+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
562+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
564+ tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
566− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
566+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
567 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
567 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
569 rotateTo(90);
569 rotateTo(90);
571− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
571+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
572 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
572 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
574 rotateTo(180);
574 rotateTo(180);
576− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
576+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
577 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
577 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
579 rotateTo(270);
579 rotateTo(270);
581− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
581+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
582 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
582 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
@@ -816,12 +816,13 @@ Rectangle {
819+ - launch an app that only supports the primary orientation
819 - launch an app that supports all orientations, such as twitter-webapp
820 - launch an app that supports all orientations, such as twitter-webapp
820 - wait a bit until that app is considered to have finished initializing and is thus
821 - wait a bit until that app is considered to have finished initializing and is thus
821 ready to get resized/rotated
822 ready to get resized/rotated
822− - switch back to dash
823+ - switch back to previous app (only supporting primary
823 - rotate device to 90 degrees
824 - rotate device to 90 degrees
824− - Physical orientation is 90 but Shell orientation is kept at 0 because unity8-dash
825+ - Physical orientation is 90 but Shell orientation is kept at 0 because the app
825 doesn't support such orientation
826 doesn't support such orientation
826 - do a long right-edge drag to show the apps spread
827 - do a long right-edge drag to show the apps spread
827 - tap on twitter-webapp
828 - tap on twitter-webapp
@@ -838,6 +839,13 @@ Rectangle {
839 function test_greeterStaysAwayAfterRotation() {
840 function test_greeterStaysAwayAfterRotation() {
840 loadShell("mako");
841 loadShell("mako");
843+ // Load an app which only supports primary
844+ var primarySurfaceId = topLevelSurfaceList.nextId;
845+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
847+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
841 var twitterSurfaceId = topLevelSurfaceList.nextId;
849 var twitterSurfaceId = topLevelSurfaceList.nextId;
842 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
850 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
843 verify(twitterApp);
851 verify(twitterApp);
@@ -850,12 +858,11 @@ Rectangle {
850 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
858 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
851 waitUntilAppWindowCanRotate(twitterSurfaceId);
859 waitUntilAppWindowCanRotate(twitterSurfaceId);
853− // go back to unity8-dash
861+ // go back to primary-oriented-app
854 performEdgeSwipeToSwitchToPreviousApp();
862 performEdgeSwipeToSwitchToPreviousApp();
856 rotateTo(90);
864 rotateTo(90);
857 wait(1); // spin the event loop to let all bindings do their thing
865 wait(1); // spin the event loop to let all bindings do their thing
858− // should not rotat as unity8-dash doesn't support it
859 tryCompare(shell, "transformRotationAngle", 0);
866 tryCompare(shell, "transformRotationAngle", 0);
861 performEdgeSwipeToShowAppSpread();
868 performEdgeSwipeToShowAppSpread();
@@ -1257,7 +1264,7 @@ Rectangle {
1257 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1476757
1264 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1476757
1260− 1- have a portrait-only app in foreground (eg unity8-dash)
1267+ 1- have a portrait-only app in foreground (eg primary-oriented-app)
1261 2- launch or switch to some other application
1268 2- launch or switch to some other application
1262 3- right-edge swipe to show the apps spread
1269 3- right-edge swipe to show the apps spread
1263 4- swipe up to close the current app (the one from step 2)
1270 4- swipe up to close the current app (the one from step 2)
@@ -1275,8 +1282,10 @@ Rectangle {
1275 function test_lockPhoneAfterClosingAppInSpreadThenUnlockAndRotate() {
1282 function test_lockPhoneAfterClosingAppInSpreadThenUnlockAndRotate() {
1276 loadShell("mako");
1283 loadShell("mako");
1278− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
1285+ var primarySurfaceId = topLevelSurfaceList.nextId;
1279− var dashSurfaceId = topLevelSurfaceList.idAt(0);
1286+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
1287+ verify(primaryApp);
1288+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
1281 var gmailSurfaceId = topLevelSurfaceList.nextId;
1290 var gmailSurfaceId = topLevelSurfaceList.nextId;
1282 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
1291 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
@@ -1298,7 +1307,7 @@ Rectangle {
1299 swipeAwayGreeter();
1308 swipeAwayGreeter();
1301− verify(isAppSurfaceFocused(dashSurfaceId))
1310+ verify(isAppSurfaceFocused(primarySurfaceId))
1303 signalSpy.clear();
1312 signalSpy.clear();
1304 signalSpy.target = shell;
1313 signalSpy.target = shell;