on xenial help sign in
merged with fix-dash-in-sidestage
commit4cbca1b84fd819b130dbbe6aeaceacf99b54682f authorNick Dedekind <nick.dedekind@canonical.com> dateMon 20 Jun 2016, 14:22 (10 years ago) parente4e311e6cec3a3
4 files changed+98−46
qml/Stages/TabletStage.qml+2−1 tests/mocks/Unity/Application/ApplicationManager.cpp+6−1 tests/qmltests/Stages/tst_TabletStage.qml+37 tests/qmltests/tst_OrientedShell.qml+53−44
qml/Stages/TabletStage.qml+2−1
@@ -852,7 +852,7 @@ AbstractStage {
852852 function refreshStage() {
853853 var newStage = ApplicationInfoInterface.MainStage;
854854 if (priv.sideStageEnabled) {
855− if (application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
855+ if (!isDash && application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
856856 newStage = WindowStateStorage.getStage(application.appId);
857857 }
858858 }
@@ -1087,6 +1087,7 @@ AbstractStage {
10871087 // only accept opposite stage.
10881088 Drag.keys: {
10891089 if (!surface) return "Disabled";
1090+ if (spreadDelegate.isDash) return "Disabled";
10901091
10911092 if (spreadDelegate.stage === ApplicationInfo.MainStage) {
10921093 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+37
@@ -603,6 +603,8 @@ Rectangle {
603603
604604 dragToSideStage(webbrowserSurfaceId);
605605
606+ var spreadView = findChild(tabletStageLoader, "spreadView")
607+ tryCompare(spreadView, "surfaceDragging", false);
606608 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
607609 }
608610
@@ -619,6 +621,8 @@ Rectangle {
619621
620622 dragToMainStage(webbrowserSurfaceId);
621623
624+ var spreadView = findChild(tabletStageLoader, "spreadView")
625+ tryCompare(spreadView, "surfaceDragging", false);
622626 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
623627 }
624628
@@ -760,9 +764,40 @@ Rectangle {
760764
761765 dragToSideStage(webbrowserSurfaceId);
762766
767+ var spreadView = findChild(tabletStageLoader, "spreadView")
768+ tryCompare(spreadView, "surfaceDragging", false);
763769 tryCompare(appDelegate.surface, "activeFocus", true);
764770 }
765771
772+ function test_dashDoesNotDragToSidestage() {
773+ sideStage.showNow();
774+ compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
775+ var dashSurfaceId = topSurfaceList.idAt(0);
776+
777+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + dashSurfaceId);
778+ verify(appDelegate);
779+ compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
780+
781+ var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
782+ var end_pos = tabletStage.width - sideStage.width / 2;
783+
784+ multiTouchDragUntil([0,1,2],
785+ tabletStage,
786+ pos,
787+ tabletStage.height / 2,
788+ units.gu(3),
789+ 0,
790+ function() {
791+ pos += units.gu(3);
792+ return sideStage.shown && !sideStage.showAnimation.running &&
793+ pos >= end_pos;
794+ });
795+
796+ var spreadView = findChild(tabletStageLoader, "spreadView")
797+ tryCompare(spreadView, "surfaceDragging", false);
798+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
799+ }
800+
766801 function test_switchStageOnRotation() {
767802 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
768803 var webbrowserSurfaceId = topSurfaceList.nextId;
@@ -822,5 +857,7 @@ Rectangle {
822857 verify(appDelegate);
823858 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
824859 }
860+
861+
825862 }
826863}
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;