on xenial help sign in
Apply the SurfaceManager related fixes for tst_OrientedShell as well
commitbd0786a0f47a7a9242cf4540e1e5ff086007169c authorRodney Dawes <dobey@ubports.com> dateThu 14 Jan 2021, 18:53 (6 years ago) parent81062a3
1 file changed+257−219
tests/qmltests/tst_OrientedShell.qml+257−219
tests/qmltests/tst_OrientedShell.qml+257−219
@@ -39,6 +39,8 @@ Rectangle {
3939 width: units.gu(160) + controls.width
4040 height: units.gu(100)
4141
42+ property var tryShell: null
43+
4244 Binding {
4345 target: LightDMController
4446 property: "userMode"
@@ -93,7 +95,7 @@ Rectangle {
9395 State {
9496 name: "mako"
9597 PropertyChanges {
96− target: orientedShellLoader
98+ target: shellRect
9799 width: units.gu(40)
98100 height: units.gu(71)
99101 }
@@ -109,7 +111,7 @@ Rectangle {
109111 State {
110112 name: "manta"
111113 PropertyChanges {
112− target: orientedShellLoader
114+ target: shellRect
113115 width: units.gu(160)
114116 height: units.gu(60)
115117 }
@@ -125,7 +127,7 @@ Rectangle {
125127 State {
126128 name: "flo"
127129 PropertyChanges {
128− target: orientedShellLoader
130+ target: shellRect
129131 width: units.gu(60)
130132 height: units.gu(100)
131133 }
@@ -141,7 +143,7 @@ Rectangle {
141143 State {
142144 name: "desktop"
143145 PropertyChanges {
144− target: orientedShellLoader
146+ target: shellRect
145147 width: units.gu(100)
146148 height: units.gu(65)
147149 }
@@ -156,26 +158,21 @@ Rectangle {
156158 }
157159 ]
158160
159− Loader {
160− id: orientedShellLoader
161+ Component {
162+ id: shellComponent
163+ OrientedShell {
164+ anchors.fill: parent
165+ physicalOrientation: root.physicalOrientation0
166+ orientationLocked: orientationLockedCheckBox.checked
167+ orientationLock: mockOrientationLock
168+ }
169+ }
161170
171+ Rectangle {
172+ id: shellRect
173+ color: "black"
162174 x: ((root.width - controls.width) - width) / 2
163175 y: (root.height - height) / 2
164−
165− focus: true
166−
167− property bool itemDestroyed: false
168− sourceComponent: Component {
169− OrientedShell {
170− anchors.fill: parent
171− physicalOrientation: root.physicalOrientation0
172− orientationLocked: orientationLockedCheckBox.checked
173− orientationLock: mockOrientationLock
174− Component.onDestruction: {
175− orientedShellLoader.itemDestroyed = true;
176− }
177− }
178− }
179176 }
180177
181178 function orientationsToStr(orientations) {
@@ -224,11 +221,19 @@ Rectangle {
224221 id: controlsColumn
225222 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
226223 spacing: units.gu(1)
224+
225+ Button {
226+ text: "Load shell"
227+ onClicked: {
228+ createTryShell();
229+ }
230+ }
231+
227232 Button {
228233 text: "Show Greeter"
229234 activeFocusOnPress: false
230235 onClicked: {
231− if (orientedShellLoader.status !== Loader.Ready)
236+ if (tryShell === null)
232237 return;
233238
234239 LightDM.Greeter.showGreeter();
@@ -241,10 +246,8 @@ Rectangle {
241246 id: rotate0Button
242247 text: root.orientationsToStr(root.physicalOrientation0) + " (0)"
243248 activeFocusOnPress: false
244− onClicked: {
245− orientedShellLoader.item.physicalOrientation = root.physicalOrientation0;
246− }
247− color: orientedShellLoader.item && orientedShellLoader.item.physicalOrientation === root.physicalOrientation0 ?
249+ onClicked: rotate0(tryShell)
250+ color: tryShell && tryShell.physicalOrientation === root.physicalOrientation0 ?
248251 UbuntuColors.green :
249252 __styleInstance.defaultColor
250253 }
@@ -252,10 +255,8 @@ Rectangle {
252255 id: rotate90Button
253256 text: root.orientationsToStr(root.physicalOrientation90) + " (90)"
254257 activeFocusOnPress: false
255− onClicked: {
256− orientedShellLoader.item.physicalOrientation = root.physicalOrientation90;
257− }
258− color: orientedShellLoader.item && orientedShellLoader.item.physicalOrientation === root.physicalOrientation90 ?
258+ onClicked: rotate90(tryShell)
259+ color: tryShell && tryShell.physicalOrientation === root.physicalOrientation90 ?
259260 UbuntuColors.green :
260261 __styleInstance.defaultColor
261262 }
@@ -263,10 +264,8 @@ Rectangle {
263264 id: rotate180Button
264265 text: root.orientationsToStr(root.physicalOrientation180) + " (180)"
265266 activeFocusOnPress: false
266− onClicked: {
267− orientedShellLoader.item.physicalOrientation = root.physicalOrientation180;
268− }
269− color: orientedShellLoader.item && orientedShellLoader.item.physicalOrientation === root.physicalOrientation180 ?
267+ onClicked: rotate180(tryShell)
268+ color: tryShell && tryShell.physicalOrientation === root.physicalOrientation180 ?
270269 UbuntuColors.green :
271270 __styleInstance.defaultColor
272271 }
@@ -274,10 +273,8 @@ Rectangle {
274273 id: rotate270Button
275274 text: root.orientationsToStr(root.physicalOrientation270) + " (270)"
276275 activeFocusOnPress: false
277− onClicked: {
278− orientedShellLoader.item.physicalOrientation = root.physicalOrientation270;
279− }
280− color: orientedShellLoader.item && orientedShellLoader.item.physicalOrientation === root.physicalOrientation270 ?
276+ onClicked: rotate270(tryShell)
277+ color: tryShell && tryShell.physicalOrientation === root.physicalOrientation270 ?
281278 UbuntuColors.green :
282279 __styleInstance.defaultColor
283280 }
@@ -297,7 +294,7 @@ Rectangle {
297294 Button {
298295 text: "Power dialog"
299296 activeFocusOnPress: false
300− onClicked: { testCase.showPowerDialog(); }
297+ onClicked: { testCase.showPowerDialog(tryShell); }
301298 }
302299 ListItem.ItemSelector {
303300 id: deviceNameSelector
@@ -306,9 +303,9 @@ Rectangle {
306303 text: "Device Name"
307304 model: ["mako", "manta", "flo", "desktop"]
308305 onSelectedIndexChanged: {
309− testCase.tearDown();
306+ destroyShell();
310307 applicationArguments.deviceName = model[selectedIndex];
311− orientedShellLoader.active = true;
308+ createTryShell();
312309 }
313310 }
314311 ListItem.ItemSelector {
@@ -356,6 +353,7 @@ Rectangle {
356353 text: "Input Method"
357354 }
358355 }
356+
359357 Button {
360358 text: Powerd.status === Powerd.On ? "Display ON" : "Display OFF"
361359 activeFocusOnPress: false
@@ -440,15 +438,43 @@ Rectangle {
440438 }
441439 }
442440
441+ function createTryShell() {
442+ if (root.tryShell === null) {
443+ root.tryShell = shellComponent.createObject(shellRect);
444+ }
445+ }
446+
447+ function destroyShell() {
448+ if (root.tryShell === null) {
449+ return;
450+ }
451+ tryShell.destroy();
452+ testCase.wait(100); // Need to wait for things like the SurfaceManager to be destroyed
453+
454+ testCase.tearDown();
455+ }
456+
457+ function rotate0(orientedShell) {
458+ orientedShell.physicalOrientation = root.physicalOrientation0;
459+ }
460+
461+ function rotate90(orientedShell) {
462+ orientedShell.physicalOrientation = root.physicalOrientation90;
463+ }
464+
465+ function rotate180(orientedShell) {
466+ orientedShell.physicalOrientation = root.physicalOrientation180;
467+ }
468+
469+ function rotate270(orientedShell) {
470+ orientedShell.physicalOrientation = root.physicalOrientation270;
471+ }
472+
443473 UnityTestCase {
444474 id: testCase
445475 name: "OrientedShell"
446476 when: windowShown
447477
448− property Item orientedShell: orientedShellLoader.status === Loader.Ready ? orientedShellLoader.item : null
449− property Item shell
450− property QtObject topLevelSurfaceList
451−
452478 SignalSpy { id: signalSpy }
453479 SignalSpy { id: signalSpy2 }
454480
@@ -464,62 +490,41 @@ Rectangle {
464490 }
465491
466492 function init() {
467− if (orientedShellLoader.active) {
468− // happens for the very first test function as shell
469− // is loaded by default
470− tearDown();
471− }
472− }
473−
474− function tearDown() {
475− orientedShellLoader.itemDestroyed = false;
476− orientedShellLoader.active = false;
477−
478− tryCompare(orientedShellLoader, "status", Loader.Null);
479− tryCompare(orientedShellLoader, "item", null);
480− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
481− // actually took place. Likely because Loader waits until the next event loop
482− // iteration to do its work. So to ensure the reload, we will wait until the
483− // Shell instance gets destroyed.
484− tryCompare(orientedShellLoader, "itemDestroyed", true);
485−
486− // kill all (fake) running apps
487− killApps();
488−
489493 while (miceModel.count > 0)
490494 MockInputDeviceBackend.removeDevice("/mouse" + (miceModel.count - 1));
491495 while (touchpadModel.count > 0)
492496 MockInputDeviceBackend.removeDevice("/touchpad" + (touchpadModel.count - 1));
493497 while (keyboardsModel.count > 0)
494498 MockInputDeviceBackend.removeDevice("/kbd" + (keyboardsModel.count - 1))
499+ usageModeSelector.selectStaged();
500+ }
495501
496− appRepeaterConnections.target = null;
497− appRepeaterConnections.itemAddedCallback = null;
498− signalSpy.target = null;
499− signalSpy.signalName = "";
500−
502+ function tearDown() {
503+ // kill all (fake) running apps
504+ testCase.killApps();
501505 LightDM.Greeter.authenticate(""); // reset greeter
502−
503− usageModeSelector.selectStaged();
504506 }
505507
506508 function cleanup() {
507− tryCompare(shell, "waitingOnGreeter", false, 10000); // make sure greeter didn't leave us in disabled state
508− shell = null;
509− topLevelSurfaceList = null;
509+ appRepeaterConnections.target = null;
510+ appRepeaterConnections.itemAddedCallback = null;
511+ signalSpy.target = null;
512+ signalSpy.signalName = "";
510513
511514 tearDown();
512515 }
513516
514517 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
515− loadShell("mako");
518+ var orientedShell = loadShell("mako");
519+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
520+ var shell = findChild(orientedShell, "shell");
516521
517522 var primarySurfaceId = topLevelSurfaceList.nextId;
518523 var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
519524 verify(primaryApp);
520− waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
525+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId, orientedShell);
521526
522− var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
527+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId, orientedShell);
523528 verify(primaryAppWindow)
524529 var primaryDelegate = findChild(shell, "appDelegate_" + primarySurfaceId);
525530
@@ -528,22 +533,22 @@ Rectangle {
528533 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
529534
530535 tryVerify(function(){return primaryDelegate.surface});
531− verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
536+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell));
532537
533538 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
534− rotateTo(90);
539+ rotateTo(90, orientedShell);
535540
536− verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
541+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell));
537542 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
538543
539− rotateTo(180);
544+ rotateTo(180, orientedShell);
540545
541− verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
546+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell));
542547 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
543548
544− rotateTo(270);
549+ rotateTo(270, orientedShell);
545550
546− verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
551+ verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell));
547552 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
548553 }
549554
@@ -554,14 +559,16 @@ Rectangle {
554559 ];
555560 }
556561 function test_appSupportingOnlyPrimaryOrientationWillOnlyRotateInLandscape(data) {
557− loadShell(data.deviceName);
562+ var orientedShell = loadShell(data.deviceName);
563+ var shell = findChild(orientedShell, "shell");
564+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
558565
559566 var primarySurfaceId = topLevelSurfaceList.nextId;
560567 var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
561568 verify(primaryApp);
562− waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
569+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId, orientedShell);
563570
564− var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
571+ var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId, orientedShell);
565572 verify(primaryAppWindow)
566573
567574 // primary-oriented-app supports only primary orientation
@@ -574,22 +581,22 @@ Rectangle {
574581
575582 tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
576583
577− tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
584+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell)}, true);
578585 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
579586
580− rotateTo(90);
587+ rotateTo(90, orientedShell);
581588
582− tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle)}, true);
589+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle, orientedShell)}, true);
583590 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
584591
585− rotateTo(180);
592+ rotateTo(180, orientedShell);
586593
587− tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
594+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180, orientedShell)}, true);
588595 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
589596
590− rotateTo(270);
597+ rotateTo(270, orientedShell);
591598
592− tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180)}, true);
599+ tryCompareFunction(function(){return checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle + 180, orientedShell)}, true);
593600 compare(shell.transformRotationAngle, root.primaryOrientationAngle + 180);
594601 }
595602
@@ -601,7 +608,8 @@ Rectangle {
601608 ];
602609 }
603610 function test_greeterRemainsInPrimaryOrientation(data) {
604− loadShell(data.deviceName);
611+ var orientedShell = loadShell(data.deviceName);
612+ var shell = findChild(orientedShell, "shell");
605613
606614 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
607615 verify(gmailApp);
@@ -615,17 +623,17 @@ Rectangle {
615623 tryCompare(shell, "orientationChangesEnabled", true);
616624
617625 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
618− rotateTo(90);
626+ rotateTo(90, orientedShell);
619627 tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle + 90);
620628
621− showGreeter();
629+ showGreeter(orientedShell);
622630
623631 tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
624− rotateTo(180);
632+ rotateTo(180, orientedShell);
625633 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
626− rotateTo(270);
634+ rotateTo(270, orientedShell);
627635 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
628− rotateTo(0);
636+ rotateTo(0, orientedShell);
629637 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
630638 }
631639
@@ -640,7 +648,9 @@ Rectangle {
640648 ];
641649 }
642650 function test_appRotatesWindowContents(data) {
643− loadShell(data.deviceName);
651+ var orientedShell = loadShell(data.deviceName);
652+ var shell = findChild(orientedShell, "shell");
653+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
644654
645655 if (data.windowed) {
646656 usageModeSelector.selectWindowed();
@@ -660,7 +670,7 @@ Rectangle {
660670 compare(cameraApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
661671 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
662672
663− waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
673+ waitUntilAppWindowIsFullyLoaded(cameraSurfaceId, orientedShell);
664674
665675 var focusChangedSpy = signalSpy;
666676 focusChangedSpy.clear();
@@ -688,7 +698,7 @@ Rectangle {
688698 transitionSpy.signalName = "runningChanged";
689699 verify(transitionSpy.valid);
690700
691− rotateTo(90);
701+ rotateTo(90, orientedShell);
692702
693703 tryCompare(cameraSurface, "orientationAngle", data.orientationAngleAfterRotation);
694704
@@ -726,7 +736,9 @@ Rectangle {
726736 ];
727737 }
728738 function test_switchingToAppWithDifferentRotation(data) {
729− loadShell(data.deviceName);
739+ var orientedShell = loadShell(data.deviceName);
740+ var shell = findChild(orientedShell, "shell");
741+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
730742 var gmailSurfaceId = topLevelSurfaceList.nextId;
731743 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
732744 verify(gmailApp);
@@ -736,7 +748,7 @@ Rectangle {
736748 compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
737749 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
738750
739− waitUntilAppWindowIsFullyLoaded(gmailSurfaceId);
751+ waitUntilAppWindowIsFullyLoaded(gmailSurfaceId, orientedShell);
740752
741753 var musicSurfaceId = topLevelSurfaceList.nextId;
742754 var musicApp = ApplicationManager.startApplication("music-app");
@@ -751,13 +763,13 @@ Rectangle {
751763 compare(musicDelegate.stage, ApplicationInfoInterface.MainStage);
752764 }
753765
754− waitUntilAppWindowIsFullyLoaded(musicSurfaceId);
766+ waitUntilAppWindowIsFullyLoaded(musicSurfaceId, orientedShell);
755767 tryCompare(shell, "orientationChangesEnabled", true);
756768
757− rotateTo(90);
769+ rotateTo(90, orientedShell);
758770 tryCompare(shell, "transformRotationAngle", data.shellAngleAfterRotation);
759771
760− performEdgeSwipeToSwitchToPreviousApp();
772+ performEdgeSwipeToSwitchToPreviousApp(orientedShell);
761773
762774 tryCompare(shell, "mainAppWindowOrientationAngle", data.shellAngleAfterRotation);
763775 compare(shell.transformRotationAngle, data.shellAngleAfterRotation);
@@ -785,7 +797,9 @@ Rectangle {
785797 orientation (Screen.orientation), so they are both equally good alternatives
786798 */
787799 function test_rotateToUnsupportedDeviceOrientation(data) {
788− loadShell("mako");
800+ var orientedShell = loadShell("mako");
801+ var shell = findChild(orientedShell, "shell");
802+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
789803 var twitterSurfaceId = topLevelSurfaceList.nextId;
790804 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
791805 verify(twitterApp);
@@ -795,12 +809,12 @@ Rectangle {
795809 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
796810 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
797811
798− waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
812+ waitUntilAppWindowIsFullyLoaded(twitterSurfaceId, orientedShell);
799813
800− rotateTo(data.rotationAngle);
814+ rotateTo(data.rotationAngle, orientedShell);
801815 tryCompare(shell, "transformRotationAngle", data.rotationAngle);
802816
803− rotateTo(180);
817+ rotateTo(180, orientedShell);
804818 tryCompare(shell, "transformRotationAngle", data.rotationAngle);
805819 }
806820 function test_rotateToUnsupportedDeviceOrientation_data() {
@@ -811,7 +825,9 @@ Rectangle {
811825 }
812826
813827 function test_launchLandscapeOnlyAppFromPortrait() {
814− loadShell("mako");
828+ var orientedShell = loadShell("mako");
829+ var shell = findChild(orientedShell, "shell");
830+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
815831 var weatherSurfaceId = topLevelSurfaceList.nextId;
816832 var weatherApp = ApplicationManager.startApplication("ubuntu-weather-app");
817833 verify(weatherApp);
@@ -819,7 +835,7 @@ Rectangle {
819835 // ensure the mock app is as we expect
820836 compare(weatherApp.supportedOrientations, Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation);
821837
822− waitUntilAppWindowIsFullyLoaded(weatherSurfaceId);
838+ waitUntilAppWindowIsFullyLoaded(weatherSurfaceId, orientedShell);
823839
824840 var rotationStates = findInvisibleChild(orientedShell, "rotationStates");
825841 waitUntilTransitionsEnd(rotationStates);
@@ -851,13 +867,15 @@ Rectangle {
851867 have an opacity > 0.
852868 */
853869 function test_greeterStaysAwayAfterRotation() {
854− loadShell("mako");
870+ var orientedShell = loadShell("mako");
871+ var shell = findChild(orientedShell, "shell");
872+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
855873
856874 // Load an app which only supports primary
857875 var primarySurfaceId = topLevelSurfaceList.nextId;
858876 var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
859877 verify(primaryApp);
860− waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
878+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId, orientedShell);
861879
862880 var twitterSurfaceId = topLevelSurfaceList.nextId;
863881 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
@@ -868,17 +886,17 @@ Rectangle {
868886 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
869887 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
870888
871− waitUntilAppWindowIsFullyLoaded(twitterSurfaceId);
872− waitUntilAppWindowCanRotate(twitterSurfaceId);
889+ waitUntilAppWindowIsFullyLoaded(twitterSurfaceId, orientedShell);
890+ waitUntilAppWindowCanRotate(twitterSurfaceId, orientedShell);
873891
874892 // go back to primary-oriented-app
875− performEdgeSwipeToSwitchToPreviousApp();
893+ performEdgeSwipeToSwitchToPreviousApp(orientedShell);
876894
877− rotateTo(90);
895+ rotateTo(90, orientedShell);
878896 wait(1); // spin the event loop to let all bindings do their thing
879897 tryCompare(shell, "transformRotationAngle", 0);
880898
881− performEdgeSwipeToShowAppSpread();
899+ performEdgeSwipeToShowAppSpread(shell);
882900
883901 // wait until things have settled
884902 var greeter = findChild(shell, "greeter");
@@ -903,7 +921,9 @@ Rectangle {
903921 }
904922 function test_appInSideStageDoesntRotateOnStartUp(data) {
905923 WindowStateStorage.saveStage("twitter-webapp", ApplicationInfoInterface.SideStage)
906− loadShell(data.deviceName);
924+ var orientedShell = loadShell(data.deviceName);
925+ var shell = findChild(orientedShell, "shell");
926+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
907927
908928 var twitterSurfaceId = topLevelSurfaceList.nextId;
909929 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
@@ -933,7 +953,8 @@ Rectangle {
933953 ];
934954 }
935955 function test_portraitOnlyAppInSideStage(data) {
936− loadShell(data.deviceName);
956+ var orientedShell = loadShell(data.deviceName);
957+ var shell = findChild(orientedShell, "shell");
937958
938959 var dialerDelegate = null;
939960 verify(appRepeaterConnections.target);
@@ -974,12 +995,13 @@ Rectangle {
974995 ];
975996 }
976997 function test_launchedAppHasActiveFocus(data) {
977− loadShell(data.deviceName);
998+ var orientedShell = loadShell(data.deviceName);
999+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
9781000
9791001 var gmailSurfaceId = topLevelSurfaceList.nextId;
9801002 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
9811003 verify(gmailApp);
982− waitUntilAppWindowIsFullyLoaded(gmailSurfaceId);
1004+ waitUntilAppWindowIsFullyLoaded(gmailSurfaceId, orientedShell);
9831005
9841006 var gmailSurface = gmailApp.surfaceList.get(0);
9851007 verify(gmailSurface);
@@ -988,12 +1010,14 @@ Rectangle {
9881010 }
9891011
9901012 function test_launchLandscapeOnlyAppOverPortraitOnlyDashThenSwitchToDash() {
991− loadShell("mako");
1013+ var orientedShell = loadShell("mako");
1014+ var shell = findChild(orientedShell, "shell");
1015+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
9921016
9931017 var dashSurfaceId = topLevelSurfaceList.nextId;
9941018 var dashApp = ApplicationManager.startApplication("unity8-dash");
9951019 verify(dashApp);
996− waitUntilAppWindowIsFullyLoaded(dashSurfaceId);
1020+ waitUntilAppWindowIsFullyLoaded(dashSurfaceId, orientedShell);
9971021
9981022 // starts as portrait, as unity8-dash is portrait only
9991023 tryCompare(shell, "transformRotationAngle", 0);
@@ -1005,7 +1029,7 @@ Rectangle {
10051029 // ensure the mock app is as we expect
10061030 compare(weatherApp.supportedOrientations, Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation);
10071031
1008− waitUntilAppWindowIsFullyLoaded(weatherSurfaceId);
1032+ waitUntilAppWindowIsFullyLoaded(weatherSurfaceId, orientedShell);
10091033
10101034 // should have rotated to landscape
10111035 tryCompareFunction(function () { return shell.transformRotationAngle == 270
@@ -1038,13 +1062,13 @@ Rectangle {
10381062 }
10391063
10401064 function test_attachRemoveInputDevices(data) {
1041− loadShell("mako")
1042− MockInputDeviceBackend.removeDevice("/indicator_kbd0");
1065+ var orientedShell = loadShell("mako");
10431066 var shell = findChild(orientedShell, "shell");
1067+ MockInputDeviceBackend.removeDevice("/indicator_kbd0");
10441068 var inputMethod = findChild(shell, "inputMethod");
10451069
1046− var oldWidth = orientedShellLoader.width;
1047− orientedShellLoader.width = data.screenWidth;
1070+ var oldWidth = shellRect.width;
1071+ shellRect.width = data.screenWidth;
10481072
10491073 tryCompare(shell, "usageScenario", "phone");
10501074 tryCompare(inputMethod, "enabled", true);
@@ -1062,17 +1086,17 @@ Rectangle {
10621086 tryCompare(oskSettings, "disableHeight", data.expectedMode == "desktop" || data.kbd);
10631087
10641088 // Restore width
1065− orientedShellLoader.width = oldWidth;
1089+ shellRect.width = oldWidth;
10661090 }
10671091
10681092 function test_screenSizeChanges() {
1069− loadShell("mako")
1093+ var orientedShell = loadShell("mako");
10701094 var shell = findChild(orientedShell, "shell");
10711095
10721096 tryCompare(shell, "usageScenario", "phone");
10731097
10741098 // make screen larger
1075− orientedShellLoader.width = units.gu(90);
1099+ shellRect.width = units.gu(90);
10761100 tryCompare(shell, "usageScenario", "phone");
10771101
10781102 // plug a mouse
@@ -1080,17 +1104,18 @@ Rectangle {
10801104 tryCompare(shell, "usageScenario", "desktop");
10811105
10821106 // make the screen smaller again, it should go back to staged even though there's still a mouse around
1083− orientedShellLoader.width = units.gu(40);
1107+ shellRect.width = units.gu(40);
10841108
10851109 tryCompare(shell, "usageScenario", "phone");
10861110 }
10871111
10881112 function test_overrideStaged() {
1089− loadShell("mako")
1113+ var orientedShell = loadShell("mako");
1114+ var shell = findChild(orientedShell, "shell");
10901115
10911116 // make sure we're big enough so that the automatism starts working
1092− var oldWidth = orientedShellLoader.width;
1093− orientedShellLoader.width = units.gu(100);
1117+ var oldWidth = shellRect.width;
1118+ shellRect.width = units.gu(100);
10941119
10951120 // start off by plugging a mouse, we should switch to windowed
10961121 MockInputDeviceBackend.addMockDevice("/mouse0", InputInfo.Mouse);
@@ -1117,7 +1142,7 @@ Rectangle {
11171142 tryCompare(shell, "usageScenario", "phone");
11181143
11191144 // Restore width
1120− orientedShellLoader.width = oldWidth;
1145+ shellRect.width = oldWidth;
11211146 }
11221147
11231148 function test_setsUsageModeOnStartup() {
@@ -1127,17 +1152,19 @@ Rectangle {
11271152 compare(unity8Settings.usageMode, "Staged");
11281153
11291154 // Load shell, and have it pick desktop
1130− loadShell("desktop");
1155+ var orientedShell = loadShell("desktop");
1156+ var shell = findChild(orientedShell, "shell");
11311157 compare(shell.usageScenario, "desktop");
11321158 compare(unity8Settings.usageMode, "Windowed");
11331159 }
11341160
11351161 function test_overrideWindowed() {
1136− loadShell("mako")
1162+ var orientedShell = loadShell("mako")
1163+ var shell = findChild(orientedShell, "shell");
11371164
11381165 // make sure we're big enough so that the automatism starts working
1139− var oldWidth = orientedShellLoader.width;
1140− orientedShellLoader.width = units.gu(100);
1166+ var oldWidth = shellRect.width;
1167+ shellRect.width = units.gu(100);
11411168
11421169 // No mouse attached... we should be in staged
11431170 tryCompare(shell, "usageScenario", "phone");
@@ -1155,7 +1182,7 @@ Rectangle {
11551182 tryCompare(shell, "usageScenario", "phone");
11561183
11571184 // Restore width
1158− orientedShellLoader.width = oldWidth;
1185+ shellRect.width = oldWidth;
11591186 }
11601187
11611188 /*
@@ -1180,7 +1207,8 @@ Rectangle {
11801207 hence the bug.
11811208 */
11821209 function test_phoneWithSpreadInLandscapeWhenGreeterShowsUp() {
1183− loadShell("mako");
1210+ var orientedShell = loadShell("mako");
1211+ var shell = findChild(orientedShell, "shell");
11841212
11851213 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
11861214 verify(gmailApp);
@@ -1193,12 +1221,12 @@ Rectangle {
11931221 // wait until it's able to rotate
11941222 tryCompare(shell, "orientationChangesEnabled", true);
11951223
1196− rotateTo(90);
1224+ rotateTo(90, orientedShell);
11971225 tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle + 90);
11981226
1199− performEdgeSwipeToShowAppSpread();
1227+ performEdgeSwipeToShowAppSpread(shell);
12001228
1201− showGreeter();
1229+ showGreeter(orientedShell);
12021230
12031231 tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
12041232 }
@@ -1223,22 +1251,24 @@ Rectangle {
12231251 - The portrait-only application rotates freely
12241252 */
12251253 function test_lockPhoneAfterClosingAppInSpreadThenUnlockAndRotate() {
1226− loadShell("mako");
1254+ var orientedShell = loadShell("mako");
1255+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
1256+ var shell = findChild(orientedShell, "shell");
12271257
12281258 var primarySurfaceId = topLevelSurfaceList.nextId;
12291259 var primaryApp = ApplicationManager.startApplication("primary-oriented-app");
12301260 verify(primaryApp);
1231− waitUntilAppWindowIsFullyLoaded(primarySurfaceId);
1261+ waitUntilAppWindowIsFullyLoaded(primarySurfaceId, orientedShell);
12321262
12331263 var gmailSurfaceId = topLevelSurfaceList.nextId;
12341264 var gmailApp = ApplicationManager.startApplication("gmail-webapp");
12351265 verify(gmailApp);
12361266
1237− waitUntilAppWindowIsFullyLoaded(gmailSurfaceId);
1267+ waitUntilAppWindowIsFullyLoaded(gmailSurfaceId, orientedShell);
12381268
1239− performEdgeSwipeToShowAppSpread();
1269+ performEdgeSwipeToShowAppSpread(shell);
12401270
1241− swipeToCloseCurrentAppInSpread();
1271+ swipeToCloseCurrentAppInSpread(orientedShell);
12421272
12431273 // press the power key once
12441274 Powerd.setStatus(Powerd.Off, Powerd.Unknown);
@@ -1248,23 +1278,24 @@ Rectangle {
12481278 // and a second time to turn the display back on
12491279 Powerd.setStatus(Powerd.On, Powerd.Unknown);
12501280
1251− swipeAwayGreeter();
1281+ swipeAwayGreeter(orientedShell);
12521282
1253− tryCompareFunction(function() { return isAppSurfaceFocused(primarySurfaceId)}, true, 10000)
1283+ tryCompareFunction(function() { return isAppSurfaceFocused(topLevelSurfaceList, primarySurfaceId)}, true, 10000)
12541284
12551285 signalSpy.clear();
12561286 signalSpy.target = shell;
12571287 signalSpy.signalName = "widthChanged";
12581288 verify(signalSpy.valid);
12591289
1260− rotateTo(90);
1290+ rotateTo(90, orientedShell);
12611291
12621292 // shell shouldn't have change its orientation at any moment
12631293 compare(signalSpy.count, 0);
12641294 }
12651295
12661296 function test_moveToExternalMonitor() {
1267− loadShell("flo");
1297+ var orientedShell = loadShell("flo");
1298+ var shell = findChild(orientedShell, "shell");
12681299
12691300 compare(orientedShell.orientation, Qt.InvertedLandscapeOrientation);
12701301 compare(shell.transformRotationAngle, 90);
@@ -1298,7 +1329,9 @@ Rectangle {
12981329 ];
12991330 }
13001331 function test_portraitOnlyAppInLandscapeDesktop(data) {
1301− loadShell(data.deviceName);
1332+ var orientedShell = loadShell(data.deviceName);
1333+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
1334+ var shell = findChild(orientedShell, "shell");
13021335
13031336 ////
13041337 // setup preconditions (put shell in Desktop mode and landscape)
@@ -1306,8 +1339,8 @@ Rectangle {
13061339 usageModeSelector.selectWindowed();
13071340
13081341 orientedShell.physicalOrientation = orientedShell.orientations.landscape;
1309− waitUntilShellIsInOrientation(orientedShell.orientations.landscape);
1310− waitForRotationAnimationsToFinish();
1342+ waitUntilShellIsInOrientation(orientedShell.orientations.landscape, orientedShell);
1343+ waitForRotationAnimationsToFinish(orientedShell);
13111344
13121345 ////
13131346 // Launch a portrait-only application
@@ -1320,39 +1353,39 @@ Rectangle {
13201353 compare(dialerApp.rotatesWindowContents, false);
13211354 compare(dialerApp.supportedOrientations, Qt.PortraitOrientation | Qt.InvertedPortraitOrientation);
13221355
1323− waitUntilAppWindowIsFullyLoaded(dialerSurfaceId);
1324− waitUntilAppWindowCanRotate(dialerSurfaceId);
1325− verify(isAppSurfaceFocused(dialerSurfaceId));
1356+ waitUntilAppWindowIsFullyLoaded(dialerSurfaceId, orientedShell);
1357+ waitUntilAppWindowCanRotate(dialerSurfaceId, orientedShell);
1358+ verify(isAppSurfaceFocused(topLevelSurfaceList, dialerSurfaceId));
13261359
13271360 ////
13281361 // check outcome (shell should stay in landscape)
13291362
1330− waitForRotationAnimationsToFinish();
1363+ waitForRotationAnimationsToFinish(orientedShell);
13311364 compare(shell.orientation, orientedShell.orientations.landscape);
13321365 }
13331366
13341367 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
1335− function rotateTo(angle) {
1368+ function rotateTo(angle, orientedShell) {
13361369 switch (angle) {
13371370 case 0:
1338− rotate0Button.clicked();
1371+ root.rotate0(orientedShell);
13391372 break;
13401373 case 90:
1341− rotate90Button.clicked();
1374+ root.rotate90(orientedShell);
13421375 break;
13431376 case 180:
1344− rotate180Button.clicked();
1377+ root.rotate180(orientedShell);
13451378 break;
13461379 case 270:
1347− rotate270Button.clicked();
1380+ root.rotate270(orientedShell);
13481381 break;
13491382 default:
13501383 verify(false);
13511384 }
1352− waitForRotationAnimationsToFinish();
1385+ waitForRotationAnimationsToFinish(orientedShell);
13531386 }
13541387
1355− function waitForRotationAnimationsToFinish() {
1388+ function waitForRotationAnimationsToFinish(orientedShell) {
13561389 var rotationStates = findInvisibleChild(orientedShell, "rotationStates");
13571390 verify(rotationStates.d);
13581391 verify(rotationStates.d.stateUpdateTimer);
@@ -1374,8 +1407,8 @@ Rectangle {
13741407 tryCompare(appWindowStates, "state", "surface");
13751408 }
13761409
1377− function findAppWindowForSurfaceId(surfaceId) {
1378− var delegate = findChild(shell, "appDelegate_" + surfaceId);
1410+ function findAppWindowForSurfaceId(surfaceId, orientedShell) {
1411+ var delegate = findChild(orientedShell, "appDelegate_" + surfaceId);
13791412 verify(delegate);
13801413 var appWindow = findChild(delegate, "appWindow");
13811414 return appWindow;
@@ -1383,25 +1416,28 @@ Rectangle {
13831416
13841417 // Wait until the ApplicationWindow for the given Application object is fully loaded
13851418 // (ie, the real surface has replaced the splash screen)
1386− function waitUntilAppWindowIsFullyLoaded(surfaceId) {
1387− var appWindow = findAppWindowForSurfaceId(surfaceId);
1419+ function waitUntilAppWindowIsFullyLoaded(surfaceId, orientedShell) {
1420+ var appWindow = findAppWindowForSurfaceId(surfaceId, orientedShell);
13881421 var appWindowStateGroup = findInvisibleChild(appWindow, "applicationWindowStateGroup");
13891422 tryCompareFunction(function() { return appWindowStateGroup.state === "surface" }, true);
13901423 waitUntilTransitionsEnd(appWindowStateGroup);
13911424 }
13921425
1393− function waitUntilAppWindowCanRotate(surfaceId) {
1394− var appWindow = findAppWindowForSurfaceId(surfaceId);
1426+ function waitUntilAppWindowCanRotate(surfaceId, orientedShell) {
1427+ var appWindow = findAppWindowForSurfaceId(surfaceId, orientedShell);
13951428 tryCompare(appWindow, "orientationChangesEnabled", true);
13961429 }
13971430
1398− function waitUntilShellIsInOrientation(orientation) {
1431+ function waitUntilShellIsInOrientation(orientation, orientedShell) {
1432+ var shell = findInvisibleChild(orientedShell, "shell");
13991433 tryCompare(shell, "orientation", orientation);
14001434 var rotationStates = findInvisibleChild(orientedShell, "rotationStates");
14011435 waitUntilTransitionsEnd(rotationStates);
14021436 }
14031437
1404− function performEdgeSwipeToSwitchToPreviousApp() {
1438+ function performEdgeSwipeToSwitchToPreviousApp(orientedShell) {
1439+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
1440+ var shell = findChild(orientedShell, "shell");
14051441 // swipe just enough to ensure an app switch action.
14061442 // If we swipe too much we will trigger the spread mode
14071443 // and we don't want that.
@@ -1416,41 +1452,43 @@ Rectangle {
14161452 tryCompareFunction(function(){ return topLevelSurfaceList.idAt(0); }, previousSurfaceId);
14171453 }
14181454
1419− function performEdgeSwipeToShowAppSpread() {
1420− var touchStartY = shell.height / 2;
1421− touchFlick(shell,
1422− shell.width - 1, touchStartY,
1455+ function performEdgeSwipeToShowAppSpread(orientedShell) {
1456+ var touchStartY = orientedShell.height / 2;
1457+ touchFlick(orientedShell,
1458+ orientedShell.width - 1, touchStartY,
14231459 0, touchStartY);
14241460
1425− var stage = findChild(shell, "stage");
1461+ var stage = findChild(orientedShell, "stage");
14261462 tryCompare(stage, "state", "spread");
14271463 waitForRendering(stage);
14281464 }
14291465
1430− function showPowerDialog() {
1466+ function showPowerDialog(orientedShell) {
14311467 var dialogs = findChild(orientedShell, "dialogs");
14321468 var dialogsPrivate = findInvisibleChild(dialogs, "dialogsPrivate");
14331469 dialogsPrivate.showPowerDialog();
14341470 }
14351471
1436− function swipeAwayGreeter() {
1472+ function swipeAwayGreeter(orientedShell) {
1473+ var shell = findChild(orientedShell, "shell");
14371474 var greeter = findChild(shell, "greeter");
1475+ verify(greeter);
14381476 tryCompare(greeter, "fullyShown", true);
14391477 waitForRendering(greeter)
14401478
14411479 var touchX = shell.width * .75;
14421480 var touchY = shell.height / 2;
1443− touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
1481+ touchFlick(shell, touchX, touchY, orientedShell.width * 0.1, touchY);
14441482
14451483 // wait until the animation has finished
14461484 tryCompare(greeter, "shown", false);
14471485 waitForRendering(greeter);
14481486 }
14491487
1450− function showGreeter() {
1488+ function showGreeter(orientedShell) {
14511489 LightDM.Greeter.showGreeter();
14521490 // wait until the animation has finished
1453− var greeter = findChild(shell, "greeter");
1491+ var greeter = findChild(orientedShell, "greeter");
14541492 tryCompare(greeter, "fullyShown", true);
14551493 }
14561494
@@ -1458,32 +1496,29 @@ Rectangle {
14581496 applicationArguments.deviceName = deviceName;
14591497
14601498 // reload our test subject to get it in a fresh state once again
1461− orientedShellLoader.active = true;
1462−
1463− tryCompare(orientedShellLoader, "status", Loader.Ready);
1464− removeTimeConstraintsFromSwipeAreas(orientedShellLoader.item);
1499+ var orientedShell = createTemporaryObject(shellComponent, shellRect);
14651500
1466− shell = findChild(orientedShell, "shell");
1501+ removeTimeConstraintsFromSwipeAreas(orientedShell);
14671502
1468− topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
1469− verify(topLevelSurfaceList);
1503+ var shell = findChild(orientedShell, "shell");
14701504
14711505 tryCompare(shell, "waitingOnGreeter", false); // reset by greeter when ready
14721506
1473− waitUntilShellIsInOrientation(root.physicalOrientation0);
1507+ waitUntilShellIsInOrientation(root.physicalOrientation0, orientedShell);
14741508
1475− waitForGreeterToStabilize();
1509+ waitForGreeterToStabilize(orientedShell);
14761510
1477− swipeAwayGreeter();
1511+ swipeAwayGreeter(orientedShell);
14781512
14791513 var appRepeater = findChild(shell, "appRepeater");
14801514 if (appRepeater) {
14811515 appRepeaterConnections.target = appRepeater;
14821516 }
1517+ return orientedShell;
14831518 }
14841519
1485− function waitForGreeterToStabilize() {
1486− var greeter = findChild(shell, "greeter");
1520+ function waitForGreeterToStabilize(orientedShell) {
1521+ var greeter = findChild(orientedShell, "greeter");
14871522 verify(greeter);
14881523
14891524 var loginList = findChild(greeter, "loginList");
@@ -1496,7 +1531,7 @@ Rectangle {
14961531 }
14971532
14981533 // expectedAngle is in orientedShell's coordinate system
1499− function checkAppSurfaceOrientation(item, app, expectedAngle) {
1534+ function checkAppSurfaceOrientation(item, app, expectedAngle, orientedShell) {
15001535 var surface = app.surfaceList.get(0);
15011536 if (!surface) {
15021537 console.warn("no surface");
@@ -1539,8 +1574,9 @@ Rectangle {
15391574 return null;
15401575 }
15411576
1542− function swipeToCloseCurrentAppInSpread() {
1543− var delegateToClose = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1577+ function swipeToCloseCurrentAppInSpread(orientedShell) {
1578+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
1579+ var delegateToClose = findChild(orientedShell, "appDelegate_" + topLevelSurfaceList.idAt(0));
15441580 verify(delegateToClose);
15451581
15461582 var appIdToClose = ApplicationManager.get(0).appId;
@@ -1557,7 +1593,7 @@ Rectangle {
15571593 compare(ApplicationManager.findApplication(appIdToClose), null);
15581594 }
15591595
1560− function isAppSurfaceFocused(surfaceId) {
1596+ function isAppSurfaceFocused(topLevelSurfaceList, surfaceId) {
15611597 var index = topLevelSurfaceList.indexForId(surfaceId);
15621598 var surface = topLevelSurfaceList.surfaceAt(index);
15631599 verify(surface);
@@ -1572,9 +1608,9 @@ Rectangle {
15721608 }
15731609
15741610 function test_tabCyclyingInShutdownDialog(data) {
1575− loadShell("mako");
1611+ var orientedShell = loadShell("mako");
15761612
1577− testCase.showPowerDialog();
1613+ testCase.showPowerDialog(orientedShell);
15781614
15791615 var dialogs = findChild(orientedShell, "dialogs");
15801616 var buttons = findChildsByType(dialogs, "Button");
@@ -1600,9 +1636,9 @@ Rectangle {
16001636 }
16011637
16021638 function test_escClosesShutdownDialog() {
1603− loadShell("mako");
1639+ var orientedShell = loadShell("mako");
16041640
1605− testCase.showPowerDialog();
1641+ testCase.showPowerDialog(orientedShell);
16061642
16071643 var dialogLoader = findChild(orientedShell, "dialogLoader");
16081644 tryCompareFunction(function() { return dialogLoader.item !== null }, true);
@@ -1613,20 +1649,21 @@ Rectangle {
16131649 }
16141650
16151651 function test_focusOnShutdownDialogClose() {
1616− loadShell("manta");
1652+ var orientedShell = loadShell("manta");
1653+ var topLevelSurfaceList = findInvisibleChild(orientedShell, "topLevelSurfaceList");
16171654 usageModeSelector.selectWindowed();
16181655
16191656 var surfaceId = topLevelSurfaceList.nextId;
16201657 var app = ApplicationManager.startApplication("twitter-webapp");
1621− waitUntilAppWindowIsFullyLoaded(surfaceId);
1658+ waitUntilAppWindowIsFullyLoaded(surfaceId, orientedShell);
16221659
1623− var primaryAppWindow = findAppWindowForSurfaceId(surfaceId);
1660+ var primaryAppWindow = findAppWindowForSurfaceId(surfaceId, orientedShell);
16241661 var surface = app.surfaceList.get(0);
16251662 var surfaceItem = findSurfaceItem(primaryAppWindow, surface);
16261663
16271664 compare(window.activeFocusItem, surfaceItem);
16281665
1629− testCase.showPowerDialog();
1666+ testCase.showPowerDialog(orientedShell);
16301667
16311668 var dialogLoader = findChild(orientedShell, "dialogLoader");
16321669 tryVerify(function() { return dialogLoader.item !== null });
@@ -1637,7 +1674,7 @@ Rectangle {
16371674 compare(window.activeFocusItem, surfaceItem);
16381675
16391676 // Do it twice, our previous solution failed the second time ^_^
1640− testCase.showPowerDialog();
1677+ testCase.showPowerDialog(orientedShell);
16411678
16421679 tryVerify(function() { return dialogLoader.item !== null });
16431680
@@ -1648,7 +1685,8 @@ Rectangle {
16481685 }
16491686
16501687 function test_tutorialDisabledWithNoTouchscreen() {
1651− loadShell("desktop");
1688+ var orientedShell = loadShell("desktop");
1689+ var shell = findChild(orientedShell, "shell");
16521690 usageModeSelector.selectWindowed();
16531691
16541692 MockInputDeviceBackend.addMockDevice("/touchscreen", InputInfo.TouchScreen);