@@ -31,6 +31,8 @@ Item {
3131 anchors { fill: parent; rightMargin: units.gu(30) }
3232 dragAreaWidth: units.gu(2)
3333 maximizedAppTopMargin: units.gu(3) + units.dp(2)
34+ interactive: true
35+ orientation: Qt.PortraitOrientation
3436 }
3537
3638 Binding {
@@ -67,6 +69,21 @@ Item {
6769 ApplicationManager.get(appList.selectedAppIndex).setState(ApplicationInfoInterface.Stopped);
6870 }
6971 }
72+ Button {
73+ anchors { left: parent.left; right: parent.right }
74+ text: "Rotate device \u27F3"
75+ onClicked: {
76+ if (phoneStage.orientation == Qt.PortraitOrientation) {
77+ phoneStage.orientation = Qt.LandscapeOrientation;
78+ } else if (phoneStage.orientation == Qt.LandscapeOrientation) {
79+ phoneStage.orientation = Qt.InvertedPortraitOrientation;
80+ } else if (phoneStage.orientation == Qt.InvertedPortraitOrientation) {
81+ phoneStage.orientation = Qt.InvertedLandscapeOrientation;
82+ } else {
83+ phoneStage.orientation = Qt.PortraitOrientation;
84+ }
85+ }
86+ }
7087 }
7188 ListView {
7289 id: appList
@@ -256,6 +273,46 @@ Item {
256273 compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
257274 }
258275
276+ function test_orientation_change_sent_to_focused_app() {
277+ phoneStage.orientation = Qt.PortraitOrientation;
278+ addApps(1);
279+
280+ var spreadView = findChild(phoneStage, "spreadView");
281+ var app = findChild(spreadView, "appDelegate0");
282+ tryCompare(app, "orientation", Qt.PortraitOrientation);
283+
284+ phoneStage.orientation = Qt.LandscapeOrientation;
285+ tryCompare(app, "orientation", Qt.LandscapeOrientation);
286+ }
287+
288+ function test_orientation_change_not_sent_to_apps_while_spread_open() {
289+ phoneStage.orientation = Qt.PortraitOrientation;
290+ addApps(1);
291+
292+ var spreadView = findChild(phoneStage, "spreadView");
293+ var app = findChild(spreadView, "appDelegate0");
294+ tryCompare(app, "orientation", Qt.PortraitOrientation);
295+
296+ goToSpread();
297+ phoneStage.orientation = Qt.LandscapeOrientation;
298+ tryCompare(app, "orientation", Qt.PortraitOrientation);
299+ }
300+
301+ function test_orientation_change_not_sent_to_unfocused_app_until_it_focused() {
302+ phoneStage.orientation = Qt.PortraitOrientation;
303+ addApps(1);
304+
305+ var spreadView = findChild(phoneStage, "spreadView");
306+ var app = findChild(spreadView, "appDelegate0");
307+
308+ goToSpread();
309+ phoneStage.orientation = Qt.LandscapeOrientation;
310+ tryCompare(app, "orientation", Qt.PortraitOrientation);
311+
312+ phoneStage.select(app.application.appId);
313+ tryCompare(app, "orientation", Qt.LandscapeOrientation);
314+ }
315+
259316 function cleanup() {
260317 while (ApplicationManager.count > 1) {
261318 var oldCount = ApplicationManager.count;
@@ -263,6 +320,7 @@ Item {
263320 ApplicationManager.stopApplication(ApplicationManager.get(closingIndex).appId)
264321 tryCompare(ApplicationManager, "count", oldCount - 1)
265322 }
323+ phoneStage.orientation = Qt.PortraitOrientation;
266324 }
267325 }
268326}