@@ -503,39 +503,37 @@ Rectangle {
503503 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
504504 loadShell("mako");
505505
506− var spreadRepeater = findChild(shell, "spreadRepeater");
507− verify(spreadRepeater);
508−
509− // unity8-dash supports only primary orientation and should be already running
510− compare(spreadRepeater.count, 1);
511− var dashDelegate = spreadRepeater.itemAt(0);
512− var dashApp = dashDelegate.application;
513− verify(dashApp);
514− compare(dashApp.appId, "unity8-dash");
515− var dashAppWindow = findChild(dashDelegate, "appWindow");
516− verify(dashAppWindow);
517− compare(dashDelegate.focus, true);
518− compare(dashApp.rotatesWindowContents, false);
519− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
520− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
521−
522− tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
523− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
506+ var primarySurfaceId = topLevelSurfaceList.nextId;
507+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
508+ verify(primaryApp);
509+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
510+
511+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
512+ verify(primaryAppWindow)
513+ var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
514+
515+ compare(primaryDelegate.focus, true);
516+ compare(primaryApp.rotatesWindowContents, false);
517+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
518+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
519+
520+ tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
521+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
524522
525523 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
526524 rotateTo(90);
527525
528− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
526+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
529527 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
530528
531529 rotateTo(180);
532530
533− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
531+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
534532 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
535533
536534 rotateTo(270);
537535
538− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
536+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
539537 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
540538 }
541539
@@ -548,37 +546,39 @@ Rectangle {
548546 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
549547 loadShell(data.deviceName);
550548
551− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
552− var dashSurfaceId = topLevelSurfaceList.idAt(0);
553− var dashAppWindow = findAppWindowForSurfaceId(dashSurfaceId);
549+ var primarySurfaceId = topLevelSurfaceList.nextId;
550+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
551+ verify(primaryApp);
552+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
554553
555− // unity8-dash supports only primary orientation and should be already running
554+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
555+ verify(primaryAppWindow)
556556
557− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
558− var dashApp = dashAppWindow.application;
559− verify(dashApp);
560− compare(dashApp.rotatesWindowContents, false);
561− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
562− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
557+ // primary-oriented-app supports only primary orientation
563558
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);
565563
566− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
564+ tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
565+
566+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
567567 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
568568
569569 rotateTo(90);
570570
571− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
571+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
572572 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
573573
574574 rotateTo(180);
575575
576− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
576+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
577577 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
578578
579579 rotateTo(270);
580580
581− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
581+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
582582 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
583583 }
584584
@@ -816,12 +816,13 @@ Rectangle {
816816 }
817817
818818 /*
819+ - launch an app that only supports the primary orientation
819820 - launch an app that supports all orientations, such as twitter-webapp
820821 - wait a bit until that app is considered to have finished initializing and is thus
821822 ready to get resized/rotated
822− - switch back to dash
823+ - switch back to previous app (only supporting primary
823824 - 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
825826 doesn't support such orientation
826827 - do a long right-edge drag to show the apps spread
827828 - tap on twitter-webapp
@@ -838,6 +839,13 @@ Rectangle {
838839 */
839840 function test_greeterStaysAwayAfterRotation() {
840841 loadShell("mako");
842+
843+ // Load an app which only supports primary
844+ var primarySurfaceId = topLevelSurfaceList.nextId;
845+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
846+ verify(primaryApp);
847+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
848+
841849 var twitterSurfaceId = topLevelSurfaceList.nextId;
842850 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
843851 verify(twitterApp);
@@ -850,12 +858,11 @@ Rectangle {
850858 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
851859 waitUntilAppWindowCanRotate(twitterSurfaceId);
852860
853− // go back to unity8-dash
861+ // go back to primary-oriented-app
854862 performEdgeSwipeToSwitchToPreviousApp();
855863
856864 rotateTo(90);
857865 wait(1); // spin the event loop to let all bindings do their thing
858− // should not rotat as unity8-dash doesn't support it
859866 tryCompare(shell, "transformRotationAngle", 0);
860867
861868 performEdgeSwipeToShowAppSpread();
@@ -1257,7 +1264,7 @@ Rectangle {
12571264 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1476757
12581265
12591266 Steps:
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)
12611268 2- launch or switch to some other application
12621269 3- right-edge swipe to show the apps spread
12631270 4- swipe up to close the current app (the one from step 2)
@@ -1275,8 +1282,10 @@ Rectangle {
12751282 function test_lockPhoneAfterClosingAppInSpreadThenUnlockAndRotate() {
12761283 loadShell("mako");
12771284
1278− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
1279− var dashSurfaceId = topLevelSurfaceList.idAt(0);
1285+ var primarySurfaceId = topLevelSurfaceList.nextId;
1286+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
1287+ verify(primaryApp);
1288+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
12801289
12811290 var gmailSurfaceId = topLevelSurfaceList.nextId;
12821291 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
@@ -1298,7 +1307,7 @@ Rectangle {
12981307
12991308 swipeAwayGreeter();
13001309
1301− verify(isAppSurfaceFocused(dashSurfaceId))
1310+ verify(isAppSurfaceFocused(primarySurfaceId))
13021311
13031312 signalSpy.clear();
13041313 signalSpy.target = shell;