on xenial help sign in
Force dash to always stay in the main stage. (lp:#1592404) (LP: #1592404)
0d1c87eNick Dedekind
qml/Stages/TabletStage.qml+2−1
@@ -850,7 +850,7 @@ AbstractStage {
850 function refreshStage() {
850 function refreshStage() {
851 var newStage = ApplicationInfoInterface.MainStage;
851 var newStage = ApplicationInfoInterface.MainStage;
852 if (priv.sideStageEnabled) {
852 if (priv.sideStageEnabled) {
853− if (application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
853+ if (!isDash && application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
854 newStage = WindowStateStorage.getStage(application.appId);
854 newStage = WindowStateStorage.getStage(application.appId);
855 }
855 }
856 }
856 }
@@ -1085,6 +1085,7 @@ AbstractStage {
1085 // only accept opposite stage.
1085 // only accept opposite stage.
1086 Drag.keys: {
1086 Drag.keys: {
1087 if (!surface) return "Disabled";
1087 if (!surface) return "Disabled";
1088+ if (spreadDelegate.isDash) return "Disabled";
1088
1089
1089 if (spreadDelegate.stage === ApplicationInfo.MainStage) {
1090 if (spreadDelegate.stage === ApplicationInfo.MainStage) {
1090 if (spreadDelegate.application.supportedOrientations
1091 if (spreadDelegate.application.supportedOrientations
tests/mocks/Unity/Application/ApplicationManager.cpp+6−1
@@ -302,7 +302,6 @@ void ApplicationManager::buildListOfAvailableApplications()
302 application->setAppId("unity8-dash");
302 application->setAppId("unity8-dash");
303 application->setName("Unity 8 Mock Dash");
303 application->setName("Unity 8 Mock Dash");
304 application->setScreenshotId("unity8-dash");
304 application->setScreenshotId("unity8-dash");
305− application->setSupportedOrientations(Qt::PrimaryOrientation);
306 m_availableApplications.append(application);
305 m_availableApplications.append(application);
307
306
308 application = new ApplicationInfo(this);
307 application = new ApplicationInfo(this);
@@ -459,6 +458,12 @@ void ApplicationManager::buildListOfAvailableApplications()
459 application->setScreenshotId("libreoffice");
458 application->setScreenshotId("libreoffice");
460 application->setIsTouchApp(false);
459 application->setIsTouchApp(false);
461 m_availableApplications.append(application);
460 m_availableApplications.append(application);
461+
462+ application = new ApplicationInfo(this);
463+ application->setAppId("primary-oriented-app");
464+ application->setName("Primary Oriented");
465+ application->setSupportedOrientations(Qt::PrimaryOrientation);
466+ m_availableApplications.append(application);
462}
467}
463
468
464
469
tests/qmltests/Stages/tst_TabletStage.qml+35
@@ -570,6 +570,8 @@ Rectangle {
570 pos >= end_pos;
570 pos >= end_pos;
571 });
571 });
572
572
573+ var spreadView = findChild(tabletStageLoader, "spreadView")
574+ tryCompare(spreadView, "surfaceDragging", false);
573 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
575 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
574 }
576 }
575
577
@@ -598,6 +600,8 @@ Rectangle {
598 return pos <= end_pos;
600 return pos <= end_pos;
599 });
601 });
600
602
603+ var spreadView = findChild(tabletStageLoader, "spreadView")
604+ tryCompare(spreadView, "surfaceDragging", false);
601 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
605 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
602 }
606 }
603
607
@@ -752,7 +756,38 @@ Rectangle {
752 pos >= end_pos;
756 pos >= end_pos;
753 });
757 });
754
758
759+ var spreadView = findChild(tabletStageLoader, "spreadView")
760+ tryCompare(spreadView, "surfaceDragging", false);
755 tryCompare(appDelegate.surface, "activeFocus", true);
761 tryCompare(appDelegate.surface, "activeFocus", true);
756 }
762 }
763+
764+ function test_dashDoesNotDragToSidestage() {
765+ sideStage.showNow();
766+ compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
767+ var dashSurfaceId = topSurfaceList.idAt(0);
768+
769+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + dashSurfaceId);
770+ verify(appDelegate);
771+ compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
772+
773+ var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
774+ var end_pos = tabletStage.width - sideStage.width / 2;
775+
776+ multiTouchDragUntil([0,1,2],
777+ tabletStage,
778+ pos,
779+ tabletStage.height / 2,
780+ units.gu(3),
781+ 0,
782+ function() {
783+ pos += units.gu(3);
784+ return sideStage.shown && !sideStage.showAnimation.running &&
785+ pos >= end_pos;
786+ });
787+
788+ var spreadView = findChild(tabletStageLoader, "spreadView")
789+ tryCompare(spreadView, "surfaceDragging", false);
790+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
791+ }
757 }
792 }
758}
793}
tests/qmltests/tst_OrientedShell.qml+53−44
@@ -503,39 +503,37 @@ Rectangle {
503 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
503 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
504 loadShell("mako");
504 loadShell("mako");
505
505
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);
521−
519+
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));
524
522
525 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
523 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
526 rotateTo(90);
524 rotateTo(90);
527
525
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);
530
528
531 rotateTo(180);
529 rotateTo(180);
532
530
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);
535
533
536 rotateTo(270);
534 rotateTo(270);
537
535
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);
540 }
538 }
541
539
@@ -548,37 +546,39 @@ Rectangle {
548 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
546 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
549 loadShell(data.deviceName);
547 loadShell(data.deviceName);
550
548
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);
554
553
555− // unity8-dash supports only primary orientation and should be already running
554+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
555+ verify(primaryAppWindow)
556
556
557− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
557+ // primary-oriented-app supports only primary orientation
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);
563
558
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);
565
563
564+ tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
565+
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);
568
568
569 rotateTo(90);
569 rotateTo(90);
570
570
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);
573
573
574 rotateTo(180);
574 rotateTo(180);
575
575
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);
578
578
579 rotateTo(270);
579 rotateTo(270);
580
580
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);
583 }
583 }
584
584
@@ -816,12 +816,13 @@ Rectangle {
816 }
816 }
817
817
818 /*
818 /*
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 {
838 */
839 */
839 function test_greeterStaysAwayAfterRotation() {
840 function test_greeterStaysAwayAfterRotation() {
840 loadShell("mako");
841 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+
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);
852
860
853− // go back to unity8-dash
861+ // go back to primary-oriented-app
854 performEdgeSwipeToSwitchToPreviousApp();
862 performEdgeSwipeToSwitchToPreviousApp();
855
863
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);
860
867
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
1258
1265
1259 Steps:
1266 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)
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");
1277
1284
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);
1280
1289
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 {
1298
1307
1299 swipeAwayGreeter();
1308 swipeAwayGreeter();
1300
1309
1301− verify(isAppSurfaceFocused(dashSurfaceId))
1310+ verify(isAppSurfaceFocused(primarySurfaceId))
1302
1311
1303 signalSpy.clear();
1312 signalSpy.clear();
1304 signalSpy.target = shell;
1313 signalSpy.target = shell;