on xenial help sign in
patched oriented tests
commit2ee1df384e18bdb26372cae462ad6edd75b89ad2 authorNick Dedekind <nick.dedekind@canonical.com> dateWed 15 Jun 2016, 14:43 (10 years ago) parent6737ae1
2 files changed+53−40
tests/mocks/Unity/Application/ApplicationManager.cpp+6 tests/qmltests/tst_OrientedShell.qml+47−40
tests/mocks/Unity/Application/ApplicationManager.cpp+6
@@ -446,6 +446,12 @@ void ApplicationManager::buildListOfAvailableApplications()
446446 application->setScreenshotId("libreoffice");
447447 application->setIsTouchApp(false);
448448 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);
449455}
450456
451457
tests/qmltests/tst_OrientedShell.qml+47−40
@@ -500,39 +500,37 @@ Rectangle {
500500 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
501501 loadShell("mako");
502502
503− var spreadRepeater = findChild(shell, "spreadRepeater");
504− verify(spreadRepeater);
505−
506− // unity8-dash supports only primary orientation and should be already running
507− compare(spreadRepeater.count, 1);
508− var dashDelegate = spreadRepeater.itemAt(0);
509− var dashApp = dashDelegate.application;
510− verify(dashApp);
511− compare(dashApp.appId, "unity8-dash");
512− var dashAppWindow = findChild(dashDelegate, "appWindow");
513− verify(dashAppWindow);
514− compare(dashDelegate.focus, true);
515− compare(dashApp.rotatesWindowContents, false);
516− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
517− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
518−
519− tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
520− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
503+ var primarySurfaceId = topLevelSurfaceList.nextId;
504+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
505+ verify(primaryApp);
506+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
507+
508+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
509+ verify(primaryAppWindow)
510+ var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
511+
512+ compare(primaryDelegate.focus, true);
513+ compare(primaryApp.rotatesWindowContents, false);
514+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
515+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
516+
517+ tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
518+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
521519
522520 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
523521 rotateTo(90);
524522
525− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
523+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
526524 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
527525
528526 rotateTo(180);
529527
530− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
528+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
531529 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
532530
533531 rotateTo(270);
534532
535− verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
533+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
536534 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
537535 }
538536
@@ -545,37 +543,39 @@ Rectangle {
545543 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
546544 loadShell(data.deviceName);
547545
548− compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
549− var dashSurfaceId = topLevelSurfaceList.idAt(0);
550− var dashAppWindow = findAppWindowForSurfaceId(dashSurfaceId);
546+ var primarySurfaceId = topLevelSurfaceList.nextId;
547+ var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
548+ verify(primaryApp);
549+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
550+
551+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
552+ verify(primaryAppWindow)
551553
552− // unity8-dash supports only primary orientation and should be already running
554+ // primary-oriented-app supports only primary orientation
553555
554− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
555− var dashApp = dashAppWindow.application;
556− verify(dashApp);
557− compare(dashApp.rotatesWindowContents, false);
558− compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
559− compare(dashApp.stage, ApplicationInfoInterface.MainStage);
556+ compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
557+ compare(primaryApp.rotatesWindowContents, false);
558+ compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
559+ compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
560560
561− tryCompareFunction(function(){return dashApp.surfaceList.count > 0;}, true);
561+ tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
562562
563− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
563+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
564564 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
565565
566566 rotateTo(90);
567567
568− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle)}, true);
568+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
569569 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
570570
571571 rotateTo(180);
572572
573− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
573+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
574574 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
575575
576576 rotateTo(270);
577577
578− tryCompareFunction(function(){return checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle + 180)}, true);
578+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
579579 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
580580 }
581581
@@ -803,12 +803,13 @@ Rectangle {
803803 }
804804
805805 /*
806+ - launch an app that only supports the primary orientation
806807 - launch an app that supports all orientations, such as twitter-webapp
807808 - wait a bit until that app is considered to have finished initializing and is thus
808809 ready to get resized/rotated
809− - switch back to dash
810+ - switch back to previous app (only supporting primary
810811 - 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
812813 doesn't support such orientation
813814 - do a long right-edge drag to show the apps spread
814815 - tap on twitter-webapp
@@ -825,6 +826,13 @@ Rectangle {
825826 */
826827 function test_greeterStaysAwayAfterRotation() {
827828 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+
828836 var twitterSurfaceId = topLevelSurfaceList.nextId;
829837 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
830838 verify(twitterApp);
@@ -837,12 +845,11 @@ Rectangle {
837845 waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
838846 waitUntilAppWindowCanRotate(twitterSurfaceId);
839847
840− // go back to unity8-dash
848+ // go back to primary-oriented-app
841849 performEdgeSwipeToSwitchToPreviousApp();
842850
843851 rotateTo(90);
844852 wait(1); // spin the event loop to let all bindings do their thing
845− // should not rotat as unity8-dash doesn't support it
846853 tryCompare(shell, "transformRotationAngle", 0);
847854
848855 performEdgeSwipeToShowAppSpread();