@@ -511,7 +511,7 @@ Rectangle {
512 var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
512 var primaryAppWindow = findAppWindowForSurfaceId(primarySurfaceId);
513 verify(primaryAppWindow)
513 verify(primaryAppWindow)
514− var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
514+ var primaryDelegate = findChild(shell, "appDelegate_" + primarySurfaceId);
516 compare(primaryDelegate.focus, true);
516 compare(primaryDelegate.focus, true);
517 compare(primaryApp.rotatesWindowContents, false);
517 compare(primaryApp.rotatesWindowContents, false);
@@ -559,7 +559,7 @@ Rectangle {
559 compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
559 compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
560 compare(primaryApp.rotatesWindowContents, false);
560 compare(primaryApp.rotatesWindowContents, false);
561 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
561 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
562− var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
562+ var primaryDelegate = findChild(shell, "appDelegate_" + primarySurfaceId);
563 compare(primaryDelegate.stage, ApplicationInfoInterface.MainStage);
563 compare(primaryDelegate.stage, ApplicationInfoInterface.MainStage);
565 tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
565 tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
@@ -736,7 +736,7 @@ Rectangle {
736 compare(musicApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
736 compare(musicApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
737 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
737 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
738 if (data.deviceName === "manta" || data.deviceName === "flo") {
738 if (data.deviceName === "manta" || data.deviceName === "flo") {
739− var musicDelegate = findChild(shell, "spreadDelegate_" + musicSurfaceId);
739+ var musicDelegate = findChild(shell, "appDelegate_" + musicSurfaceId);
740 compare(musicDelegate.stage, ApplicationInfoInterface.MainStage);
740 compare(musicDelegate.stage, ApplicationInfoInterface.MainStage);
@@ -873,9 +873,9 @@ Rectangle {
873 var greeter = findChild(shell, "greeter");
873 var greeter = findChild(shell, "greeter");
874 tryCompare(greeter, "animating", false);
874 tryCompare(greeter, "animating", false);
876− var twitterDelegate = findChild(shell, "spreadDelegate_" + topLevelSurfaceList.idAt(1));
876+ var twitterDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(1));
877 compare(twitterDelegate.application.appId, "twitter-webapp");
877 compare(twitterDelegate.application.appId, "twitter-webapp");
878− twitterDelegate.clicked();
878+ tap(twitterDelegate, 1, 1);
880 // now it should finally follow the physical orientation
880 // now it should finally follow the physical orientation
881 tryCompare(shell, "transformRotationAngle", 90);
881 tryCompare(shell, "transformRotationAngle", 90);
@@ -894,24 +894,10 @@ Rectangle {
894 WindowStateStorage.saveStage("twitter-webapp", ApplicationInfoInterface.SideStage)
894 WindowStateStorage.saveStage("twitter-webapp", ApplicationInfoInterface.SideStage)
895 loadShell(data.deviceName);
895 loadShell(data.deviceName);
897− var twitterDelegate = null;
899− verify(appRepeaterConnections.target);
900− appRepeaterConnections.itemAddedCallback = function(item) {
901− verify(item.application.appId, "twitter-webapp");
902− twitterDelegate = item;
903− signalSpy.target = findInvisibleChild(item, "orientationChangeAnimation");
904− verify(signalSpy.valid);
908− signalSpy.target = null;
909− signalSpy.signalName = "runningChanged";
911 var twitterSurfaceId = topLevelSurfaceList.nextId;
897 var twitterSurfaceId = topLevelSurfaceList.nextId;
912 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
898 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
913 verify(twitterApp);
899 verify(twitterApp);
914− var twitterDelegate = findChild(shell, "spreadDelegate_" + twitterSurfaceId);
900+ var twitterDelegate = findChild(shell, "appDelegate_" + twitterSurfaceId);
915 compare(twitterDelegate.stage, ApplicationInfoInterface.SideStage);
901 compare(twitterDelegate.stage, ApplicationInfoInterface.SideStage);
917 // ensure the mock twitter-webapp is as we expect
903 // ensure the mock twitter-webapp is as we expect
@@ -919,15 +905,11 @@ Rectangle {
919 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
905 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
920 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
906 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
922− // Wait until appRepeaterConnections hs caught the new SpreadDelegate and
923− // set up the signalSpy target accordingly.
924− tryCompareFunction(function(){ return signalSpy.target != null && signalSpy.valid; }, true);
926 tryCompare(twitterDelegate, "orientationChangesEnabled", true);
908 tryCompare(twitterDelegate, "orientationChangesEnabled", true);
928− var appWindowWithShadow = findChild(twitterDelegate, "appWindowWithShadow");
910+ var decoratedWindow = findChild(twitterDelegate, "decoratedWindow");
929− verify(appWindowWithShadow);
911+ verify(decoratedWindow);
930− tryCompare(appWindowWithShadow, "state", "keepSceneRotation");
912+ tryCompare(decoratedWindow, "counterRotate", false);
932 // no reason for any rotation animation to have taken place
914 // no reason for any rotation animation to have taken place
933 compare(signalSpy.count, 0);
915 compare(signalSpy.count, 0);
@@ -960,16 +942,12 @@ Rectangle {
960 tryCompareFunction(function(){ return dialerDelegate != null; }, true);
942 tryCompareFunction(function(){ return dialerDelegate != null; }, true);
961 tryCompare(dialerDelegate, "orientationChangesEnabled", true);
943 tryCompare(dialerDelegate, "orientationChangesEnabled", true);
963− var appWindowWithShadow = findChild(dialerDelegate, "appWindowWithShadow");
945+ var decoratedWindow = findChild(dialerDelegate, "decoratedWindow");
964− verify(appWindowWithShadow);
946+ verify(decoratedWindow);
965− tryCompare(appWindowWithShadow, "state", "keepSceneRotation");
947+ tryCompare(decoratedWindow, "counterRotate", false);
967 // app must have portrait aspect ratio
949 // app must have portrait aspect ratio
968− verify(appWindowWithShadow.width < appWindowWithShadow.height);
950+ verify(decoratedWindow.width < decoratedWindow.height);
970− compare(appWindowWithShadow.rotation, 0);
972− verifyAppWindowWithinSpreadDelegateBoundaries(dialerDelegate);
974 // shell should remain in its primery orientation as the app in the main stage
952 // shell should remain in its primery orientation as the app in the main stage
975 // is the one that dictates its orientation. In this case it's unity8-dash
953 // is the one that dictates its orientation. In this case it's unity8-dash
@@ -977,83 +955,6 @@ Rectangle {
977 compare(shell.orientation, orientedShell.orientations.primary);
955 compare(shell.orientation, orientedShell.orientations.primary);
980− function test_sideStageAppsRemainPortraitInSpread_data() {
982− {tag: "manta", deviceName: "manta"},
983− {tag: "flo", deviceName: "flo"}
986− function test_sideStageAppsRemainPortraitInSpread(data) {
987− loadShell(data.deviceName);
992− var dialerDelegate = null;
993− verify(appRepeaterConnections.target);
994− appRepeaterConnections.itemAddedCallback = function(item) {
995− dialerDelegate = item;
996− verify(item.application.appId, "dialer-app");
999− WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage)
1000− var dialerApp = ApplicationManager.startApplication("dialer-app");
1003− // ensure the mock dialer-app is as we expect
1004− compare(dialerApp.rotatesWindowContents, false);
1005− compare(dialerApp.supportedOrientations, Qt.PortraitOrientation | Qt.InvertedPortraitOrientation);
1007− tryCompareFunction(function(){ return dialerDelegate != null; }, true);
1008− waitUntilAppDelegateIsFullyInit(dialerDelegate);
1013− var twitterDelegate = null;
1014− appRepeaterConnections.itemAddedCallback = function(item) {
1015− twitterDelegate = item;
1016− verify(item.application.appId, "twitter-webapp");
1019− var twitterApp = ApplicationManager.startApplication("twitter-webapp");
1020− verify(twitterApp);
1021− twitterApp.stage = ApplicationInfoInterface.SideStage;
1023− // ensure the mock twitter-webapp is as we expect
1024− compare(twitterApp.rotatesWindowContents, false);
1025− compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
1026− | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
1028− tryCompareFunction(function(){ return twitterDelegate != null; }, true);
1029− waitUntilAppDelegateIsFullyInit(twitterDelegate);
1032− // Edge swipe to show spread and check orientations
1034− performEdgeSwipeToShowAppSpread();
1037− var appWindowWithShadow = findChild(dialerDelegate, "appWindowWithShadow");
1038− verify(appWindowWithShadow);
1039− tryCompare(appWindowWithShadow, "state", "keepSceneRotation");
1040− compare(appWindowWithShadow.width, dialerDelegate.width);
1041− compare(appWindowWithShadow.height, dialerDelegate.height);
1042− compare(appWindowWithShadow.rotation, 0);
1045− var appWindowWithShadow = findChild(twitterDelegate, "appWindowWithShadow");
1046− verify(appWindowWithShadow);
1047− tryCompare(appWindowWithShadow, "state", "keepSceneRotation");
1048− compare(appWindowWithShadow.width, twitterDelegate.width);
1049− compare(appWindowWithShadow.height, twitterDelegate.height);
1050− compare(appWindowWithShadow.rotation, 0);
1053− verifyAppWindowWithinSpreadDelegateBoundaries(dialerDelegate);
1054− verifyAppWindowWithinSpreadDelegateBoundaries(twitterDelegate);
1057 function test_launchedAppHasActiveFocus_data() {
958 function test_launchedAppHasActiveFocus_data() {
1058 return [
959 return [
1059 {tag: "mako", deviceName: "mako"},
960 {tag: "mako", deviceName: "mako"},
@@ -1449,11 +1350,10 @@ Rectangle {
1449 function waitUntilAppDelegateIsFullyInit(spreadDelegate) {
1350 function waitUntilAppDelegateIsFullyInit(spreadDelegate) {
1450 tryCompare(spreadDelegate, "orientationChangesEnabled", true);
1351 tryCompare(spreadDelegate, "orientationChangesEnabled", true);
1452− var appWindowWithShadow = findChild(spreadDelegate, "appWindowWithShadow");
1353+ var decoratedWindow = findChild(spreadDelegate, "decoratedWindow");
1453− verify(appWindowWithShadow);
1354+ tryCompare(decoratedWindow, "counterRotate", false);
1454− tryCompare(appWindowWithShadow, "state", "keepSceneRotation");
1456− var appWindowStates = findInvisibleChild(appWindowWithShadow, "applicationWindowStateGroup");
1356+ var appWindowStates = findInvisibleChild(decoratedWindow, "applicationWindowStateGroup");
1457 verify(appWindowStates);
1357 verify(appWindowStates);
1458 tryCompare(appWindowStates, "state", "surface");
1358 tryCompare(appWindowStates, "state", "surface");
@@ -1491,8 +1391,7 @@ Rectangle {
1493 function performLeftEdgeSwipeToSwitchToDash() {
1393 function performLeftEdgeSwipeToSwitchToDash() {
1494− var spreadView = findChild(shell, "spreadView");
1495− var swipeLength = spreadView.width * 0.7;
1394+ var swipeLength = shell.width * 0.7;
1497 var touchStartX = 1;
1396 var touchStartX = 1;
1498 var touchStartY = shell.height / 2;
1397 var touchStartY = shell.height / 2;
@@ -1507,35 +1406,13 @@ Rectangle {
1507 // swipe just enough to ensure an app switch action.
1406 // swipe just enough to ensure an app switch action.
1508 // If we swipe too much we will trigger the spread mode
1407 // If we swipe too much we will trigger the spread mode
1509 // and we don't want that.
1408 // and we don't want that.
1510− var spreadView = findChild(shell, "spreadView");
1511− verify(spreadView);
1513 verify(topLevelSurfaceList.count >= 2);
1409 verify(topLevelSurfaceList.count >= 2);
1514 var previousSurfaceId = topLevelSurfaceList.idAt(1);
1410 var previousSurfaceId = topLevelSurfaceList.idAt(1);
1516 var touchStartX = shell.width - 1;
1412 var touchStartX = shell.width - 1;
1517 var touchStartY = shell.height / 2;
1413 var touchStartY = shell.height / 2;
1520− if (applicationArguments.deviceName === "phone") {
1521− condition = function() {
1522− return spreadView.shiftedContentX > units.gu(2) &&
1523− spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width;
1526− condition = function() {
1527− return spreadView.shiftedContentX > spreadView.width * spreadView.positionMarker1
1528− && spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2;
1532− touchDragUntil(shell,
1533− touchStartX, touchStartY,
1415+ touchFlick(shell, touchStartX, touchStartY, touchStartX - units.gu(8), touchStartY, units.gu(4), 10);
1537− // ensure the app switch animation has ended
1538− tryCompare(spreadView, "shiftedContentX", 0);
1540 tryCompareFunction(function(){ return topLevelSurfaceList.idAt(0); }, previousSurfaceId);
1417 tryCompareFunction(function(){ return topLevelSurfaceList.idAt(0); }, previousSurfaceId);
@@ -1546,11 +1423,9 @@ Rectangle {
1546 shell.width - 1, touchStartY,
1423 shell.width - 1, touchStartY,
1547 0, touchStartY);
1424 0, touchStartY);
1549− var spreadView = findChild(shell, "spreadView");
1426+ var stage = findChild(shell, "stage");
1550− verify(spreadView);
1427+ tryCompare(stage, "state", "spread");
1551− tryCompare(spreadView, "phase", 2);
1428+ waitForRendering(stage);
1552− tryCompare(spreadView, "flicking", false);
1553− tryCompare(spreadView, "moving", false);
1556 function showPowerDialog() {
1431 function showPowerDialog() {
@@ -1559,19 +1434,6 @@ Rectangle {
1559 dialogsPrivate.showPowerDialog();
1434 dialogsPrivate.showPowerDialog();
1562− function verifyAppWindowWithinSpreadDelegateBoundaries(spreadDelegate) {
1563− var appWindowWithShadow = findChild(spreadDelegate, "appWindowWithShadow");
1564− verify(appWindowWithShadow);
1566− var windowInDelegateCoords = appWindowWithShadow.mapToItem(spreadDelegate, 0, 0,
1567− appWindowWithShadow.width, appWindowWithShadow.height);
1569− compare(windowInDelegateCoords.x, 0);
1570− compare(windowInDelegateCoords.y, 0);
1571− compare(windowInDelegateCoords.width, spreadDelegate.width);
1572− compare(windowInDelegateCoords.height, spreadDelegate.height);
1575 function swipeAwayGreeter() {
1437 function swipeAwayGreeter() {
1576 var greeter = findChild(shell, "greeter");
1438 var greeter = findChild(shell, "greeter");
1577 tryCompare(greeter, "fullyShown", true);
1439 tryCompare(greeter, "fullyShown", true);
@@ -1643,11 +1505,9 @@ Rectangle {
1644 var topMargin = 0.;
1506 var topMargin = 0.;
1645 if (!app.fullscreen) {
1507 if (!app.fullscreen) {
1646− var appsDisplayLoader = findChild(shell, "applicationsDisplayLoader");
1508+ var stage = findChild(shell, "stage");
1647− verify(appsDisplayLoader);
1648− verify(appsDisplayLoader.item);
1649− verify(appsDisplayLoader.item.maximizedAppTopMargin !== undefined);
1509+ verify(stage.maximizedAppTopMargin !== undefined);
1650− topMargin = appsDisplayLoader.item.maximizedAppTopMargin;
1510+ topMargin = stage.maximizedAppTopMargin;
1653 var surfaceItem = findSurfaceItem(item, surface);
1513 var surfaceItem = findSurfaceItem(item, surface);
@@ -1687,24 +1547,12 @@ Rectangle {
1689 function swipeToCloseCurrentAppInSpread() {
1549 function swipeToCloseCurrentAppInSpread() {
1690− var spreadView = findChild(shell, "spreadView");
1691− verify(spreadView);
1693− var delegateToClose = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
1550+ var delegateToClose = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
1694 verify(delegateToClose);
1551 verify(delegateToClose);
1696− var appIdToClose = ApplicationManager.get(0).appId;;
1553+ var appIdToClose = ApplicationManager.get(0).appId;
1697 var appCountBefore = ApplicationManager.count;
1554 var appCountBefore = ApplicationManager.count;
1699− // ensure the current app is widely visible by swiping to the right,
1700− // which will move the app windows accordingly
1702− shell.width * 0.25, shell.width / 2,
1703− shell.width, shell.width / 2);
1705− tryCompare(spreadView, "flicking", false);
1706− tryCompare(spreadView, "moving", false);
1708 // Swipe up close to its left edge, as it is the only area of it guaranteed to be exposed
1556 // Swipe up close to its left edge, as it is the only area of it guaranteed to be exposed
1709 // in the spread. Eg: its center could be covered by some other delegate.
1557 // in the spread. Eg: its center could be covered by some other delegate.
1710 touchFlick(delegateToClose,
1558 touchFlick(delegateToClose,