on xenial help sign in
Force dash to always stay in the main stage. (lp:#1592404) (LP: #1592404)
commit0d1c87ef456ad8356adaae0a7d1fc487a737a7d9 authorNick Dedekind <nick.dedekind@canonical.com> dateMon 27 Jun 2016, 18:44 (10 years ago) parent4dd864f6cec3a3
4 files changed+96−46
qml/Stages/TabletStage.qml+2−1 tests/mocks/Unity/Application/ApplicationManager.cpp+6−1 tests/qmltests/Stages/tst_TabletStage.qml+35 tests/qmltests/tst_OrientedShell.qml+53−44
qml/Stages/TabletStage.qml+2−1
@@ -850,7 +850,7 @@ AbstractStage {
850850 function refreshStage() {
851851 var newStage = ApplicationInfoInterface.MainStage;
852852 if (priv.sideStageEnabled) {
853− if (application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
853+ if (!isDash && application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
854854 newStage = WindowStateStorage.getStage(application.appId);
855855 }
856856 }
@@ -1085,6 +1085,7 @@ AbstractStage {
10851085 // only accept opposite stage.
10861086 Drag.keys: {
10871087 if (!surface) return "Disabled";
1088+ if (spreadDelegate.isDash) return "Disabled";
10881089
10891090 if (spreadDelegate.stage === ApplicationInfo.MainStage) {
10901091 if (spreadDelegate.application.supportedOrientations
tests/mocks/Unity/Application/ApplicationManager.cpp+6−1
@@ -302,7 +302,6 @@ void ApplicationManager::buildListOfAvailableApplications()
302302 application->setAppId("unity8-dash");
303303 application->setName("Unity 8 Mock Dash");
304304 application->setScreenshotId("unity8-dash");
305− application->setSupportedOrientations(Qt::PrimaryOrientation);
306305 m_availableApplications.append(application);
307306
308307 application = new ApplicationInfo(this);
@@ -459,6 +458,12 @@ void ApplicationManager::buildListOfAvailableApplications()
459458 application->setScreenshotId("libreoffice");
460459 application->setIsTouchApp(false);
461460 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);
462467}
463468
464469
tests/qmltests/Stages/tst_TabletStage.qml+35
@@ -570,6 +570,8 @@ Rectangle {
570570 pos >= end_pos;
571571 });
572572
573+ var spreadView = findChild(tabletStageLoader, "spreadView")
574+ tryCompare(spreadView, "surfaceDragging", false);
573575 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
574576 }
575577
@@ -598,6 +600,8 @@ Rectangle {
598600 return pos <= end_pos;
599601 });
600602
603+ var spreadView = findChild(tabletStageLoader, "spreadView")
604+ tryCompare(spreadView, "surfaceDragging", false);
601605 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
602606 }
603607
@@ -752,7 +756,38 @@ Rectangle {
752756 pos >= end_pos;
753757 });
754758
759+ var spreadView = findChild(tabletStageLoader, "spreadView")
760+ tryCompare(spreadView, "surfaceDragging", false);
755761 tryCompare(appDelegate.surface, "activeFocus", true);
756762 }
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+ }
757792 }
758793}
tests/qmltests/tst_OrientedShell.qml+53−44
@@ -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;