on xenial help sign in
patched oriented tests
2ee1df3Nick Dedekind
tests/mocks/Unity/Application/ApplicationManager.cpp+6
@@ -446,6 +446,12 @@ void ApplicationManager::buildListOfAvailableApplications()
446 application->setScreenshotId("libreoffice");
446 application->setScreenshotId("libreoffice");
447 application->setIsTouchApp(false);
447 application->setIsTouchApp(false);
448 m_availableApplications.append(application);
448 m_availableApplications.append(application);
449+
450+ application = new ApplicationInfo(this);
451+ application->setAppId("primary-oriented-app");
452+ application->setName("Primary Oriented");
453+ application->setSupportedOrientations(Qt::PrimaryOrientation);
454+ m_availableApplications.append(application);
449}
455}
450
456
451
457
tests/qmltests/tst_OrientedShell.qml+47−40
@@ -500,39 +500,37 @@ Rectangle {
500 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
500 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
501 loadShell("mako");
501 loadShell("mako");
502
502
503− var spreadRepeater = findChild(shell, "spreadRepeater");
503+ var primarySurfaceId = topLevelSurfaceList.nextId;
504− verify(spreadRepeater);
504+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
505−
505+ verify(primaryApp);
506− // unity8-dash supports only primary orientation and should be already running
506+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
507− compare(spreadRepeater.count, 1);
507+
508− var dashDelegate = spreadRepeater.itemAt(0);
508+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
509− var dashApp = dashDelegate.application;
509+ verify(primaryAppWindow)
510− verify(dashApp);
510+ var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
511− compare(dashApp.appId, "unity8-dash");
511+
512− var dashAppWindow = findChild(dashDelegate, "appWindow");
513− verify(dashAppWindow);
514− compare(dashDelegate.focus, true);
512+ compare(primaryDelegate.focus, true);
515− compare(dashApp.rotatesWindowContents, false);
513+ compare(primaryApp.rotatesWindowContents, false);
516− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
514+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
517− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
515+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
518−
516+
519− tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
517+ tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
520− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
518+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
521
519
522 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
520 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
523 rotateTo(90);
521 rotateTo(90);
524
522
525− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
523+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
526 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
524 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
527
525
528 rotateTo(180);
526 rotateTo(180);
529
527
530− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
528+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
531 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
529 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
532
530
533 rotateTo(270);
531 rotateTo(270);
534
532
535− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
533+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
536 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
534 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
537 }
535 }
538
536
@@ -545,37 +543,39 @@ Rectangle {
545 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
543 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
546 loadShell(data.deviceName);
544 loadShell(data.deviceName);
547
545
548− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
546+ var primarySurfaceId = topLevelSurfaceList.nextId;
549− var dashSurfaceId = topLevelSurfaceList.idAt(0);
547+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
548+ verify(primaryApp);
549+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
550+
550− var dashAppWindow = findAppWindowForSurfaceId(dashSurfaceId);
551+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
552+ verify(primaryAppWindow)
551
553
552− // unity8-dash supports only primary orientation and should be already running
554+ // primary-oriented-app supports only primary orientation
553
555
554− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
556+ compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
555− var dashApp = dashAppWindow.application;
556− verify(dashApp);
557− compare(dashApp.rotatesWindowContents, false);
557+ compare(primaryApp.rotatesWindowContents, false);
558− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
558+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
559− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
559+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
560
560
561− tryCompareFunction(function(){return dashApp.surfaceList.count > 0;}, true);
561+ tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
562
562
563− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
563+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
564 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
564 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
565
565
566 rotateTo(90);
566 rotateTo(90);
567
567
568− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
568+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
569 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
569 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
570
570
571 rotateTo(180);
571 rotateTo(180);
572
572
573− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
573+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
574 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
574 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
575
575
576 rotateTo(270);
576 rotateTo(270);
577
577
578− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
578+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
579 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
579 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
580 }
580 }
581
581
@@ -803,12 +803,13 @@ Rectangle {
803 }
803 }
804
804
805 /*
805 /*
806+ - launch an app that only supports the primary orientation
806 - launch an app that supports all orientations, such as twitter-webapp
807 - launch an app that supports all orientations, such as twitter-webapp
807 - wait a bit until that app is considered to have finished initializing and is thus
808 - wait a bit until that app is considered to have finished initializing and is thus
808 ready to get resized/rotated
809 ready to get resized/rotated
809− - switch back to dash
810+ - switch back to previous app (only supporting primary
810 - rotate device to 90 degrees
811 - rotate device to 90 degrees
811− - Physical orientation is 90 but Shell orientation is kept at 0 because unity8-dash
812+ - Physical orientation is 90 but Shell orientation is kept at 0 because the app
812 doesn't support such orientation
813 doesn't support such orientation
813 - do a long right-edge drag to show the apps spread
814 - do a long right-edge drag to show the apps spread
814 - tap on twitter-webapp
815 - tap on twitter-webapp
@@ -825,6 +826,13 @@ Rectangle {
825 */
826 */
826 function test_greeterStaysAwayAfterRotation() {
827 function test_greeterStaysAwayAfterRotation() {
827 loadShell("mako");
828 loadShell("mako");
829+
830+ // Load an app which only supports primary
831+ var primarySurfaceId = topLevelSurfaceList.nextId;
832+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
833+ verify(primaryApp);
834+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
835+
828 var twitterSurfaceId = topLevelSurfaceList.nextId;
836 var twitterSurfaceId = topLevelSurfaceList.nextId;
829 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
837 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
830 verify(twitterApp);
838 verify(twitterApp);
@@ -837,12 +845,11 @@ Rectangle {
837 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
845 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
838 waitUntilAppWindowCanRotate(twitterSurfaceId);
846 waitUntilAppWindowCanRotate(twitterSurfaceId);
839
847
840− // go back to unity8-dash
848+ // go back to primary-oriented-app
841 performEdgeSwipeToSwitchToPreviousApp();
849 performEdgeSwipeToSwitchToPreviousApp();
842
850
843 rotateTo(90);
851 rotateTo(90);
844 wait(1); // spin the event loop to let all bindings do their thing
852 wait(1); // spin the event loop to let all bindings do their thing
845− // should not rotat as unity8-dash doesn't support it
846 tryCompare(shell, "transformRotationAngle", 0);
853 tryCompare(shell, "transformRotationAngle", 0);
847
854
848 performEdgeSwipeToShowAppSpread();
855 performEdgeSwipeToShowAppSpread();