@@ -22,6 +22,7 @@ import Ubuntu.Components.ListItems 1.0 as ListItem
2222import Unity.Application 0.1
2323import Unity.Test 0.1
2424import LightDM 0.1 as LightDM
25+import Powerd 0.1
2526
2627import "../../qml"
2728
@@ -161,8 +162,16 @@ Rectangle {
161162 }
162163
163164 Rectangle {
164− id: controls
165+ width: controls.width
166+ anchors {
167+ top: parent.top
168+ bottom: parent.bottom
169+ right: parent.right
170+ }
165171 color: "darkgrey"
172+ }
173+ Flickable {
174+ id: controls
166175 width: units.gu(30)
167176 anchors {
168177 top: parent.top
@@ -170,7 +179,11 @@ Rectangle {
170179 right: parent.right
171180 }
172181
182+ boundsBehavior: Flickable.StopAtBounds
183+ contentHeight: controlsColumn.height
184+
173185 Column {
186+ id: controlsColumn
174187 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
175188 spacing: units.gu(1)
176189 Button {
@@ -281,6 +294,17 @@ Rectangle {
281294 anchors.verticalCenter: parent.verticalCenter
282295 }
283296 }
297+ Button {
298+ text: Powerd.status === Powerd.On ? "Display ON" : "Display OFF"
299+ activeFocusOnPress: false
300+ onClicked: {
301+ if (Powerd.status === Powerd.On) {
302+ Powerd.status = Powerd.Off;
303+ } else {
304+ Powerd.status = Powerd.On;
305+ }
306+ }
307+ }
284308 }
285309 }
286310
@@ -947,16 +971,31 @@ Rectangle {
947971 // If we swipe too much we will trigger the spread mode
948972 // and we don't want that.
949973 var spreadView = findChild(shell, "spreadView");
950− var swipeLength = (spreadView.positionMarker1 * spreadView.width) * 0.5;
974+ verify(spreadView);
951975
952976 verify(ApplicationManager.count >= 2);
953977 var previousApp = ApplicationManager.get(1);
954978
955979 var touchStartX = shell.width - 1;
956980 var touchStartY = shell.height / 2;
957− touchFlick(shell,
958− touchStartX, touchStartY,
959− touchStartX - swipeLength, touchStartY);
981+
982+ var condition;
983+ if (applicationArguments.deviceName === "phone") {
984+ condition = function() {
985+ return spreadView.shiftedContentX > units.gu(2) &&
986+ spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width;
987+ };
988+ } else {
989+ condition = function() {
990+ return spreadView.shiftedContentX > spreadView.width * spreadView.positionMarker1
991+ && spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2;
992+ };
993+ }
994+
995+ touchDragUntil(shell,
996+ touchStartX, touchStartY,
997+ -units.gu(1), 0,
998+ condition);
960999
9611000 // ensure the app switch animation has ended
9621001 tryCompare(spreadView, "shiftedContentX", 0);
@@ -1039,6 +1078,8 @@ Rectangle {
10391078
10401079 waitUntilShellIsInOrientation(root.physicalOrientation0);
10411080
1081+ waitForGreeterToStabilize();
1082+
10421083 swipeAwayGreeter();
10431084
10441085 var spreadRepeater = findChild(shell, "spreadRepeater");
@@ -1047,6 +1088,19 @@ Rectangle {
10471088 }
10481089 }
10491090
1091+ function waitForGreeterToStabilize() {
1092+ var greeter = findChild(shell, "greeter");
1093+ verify(greeter);
1094+
1095+ var loginList = findChild(greeter, "loginList");
1096+ // Only present in WideView
1097+ if (loginList) {
1098+ var userList = findChild(loginList, "userList");
1099+ verify(userList);
1100+ tryCompare(userList, "movingInternally", false);
1101+ }
1102+ }
1103+
10501104 // expectedAngle is in orientedShell's coordinate system
10511105 function checkAppSurfaceOrientation(app, expectedAngle) {
10521106 var surface = app.session.surface;