@@ -951,6 +951,51 @@ Rectangle {
951951 tryCompare(mockOskSettings, "stayHidden", false);
952952 }
953953
954+ /*
955+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1471609
956+
957+ Steps:
958+ - Open an app which can rotate
959+ - Rotate the phone to landscape
960+ - Open the app spread
961+ - Press the power button while the app spread is open
962+ - Wait a bit and press power button again
963+
964+ Expected outcome:
965+ You see greeter in portrat (ie, primary orientation)
966+
967+ Actual outcome:
968+ You see greeter in landscape
969+
970+ Comments:
971+ Greeter supports only the primary orientation (portrait in phones) but
972+ the stage doesn't allow orientation changes while the apps spread is open,
973+ hence the bug.
974+ */
975+ function test_phoneWithSpreadInLandscapeWhenGreeterShowsUp() {
976+ loadShell("mako");
977+
978+ var gmailApp = ApplicationManager.startApplication("gmail-webapp");
979+ verify(gmailApp);
980+
981+ // ensure the mock gmail-webapp is as we expect
982+ compare(gmailApp.rotatesWindowContents, false);
983+ compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
984+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
985+
986+ // wait until it's able to rotate
987+ tryCompare(shell, "orientationChangesEnabled", true);
988+
989+ rotateTo(90);
990+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle + 90);
991+
992+ performEdgeSwipeToShowAppSpread();
993+
994+ showGreeter();
995+
996+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
997+ }
998+
954999 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
9551000 function rotateTo(angle) {
9561001 switch (angle) {