@@ -31,6 +31,7 @@ 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
3435 }
3536
3637 Binding {
@@ -67,6 +68,21 @@ Item {
6768 ApplicationManager.get(appList.selectedAppIndex).setState(ApplicationInfo.Stopped);
6869 }
6970 }
71+ Button {
72+ anchors { left: parent.left; right: parent.right }
73+ text: "Rotate device \u27F2"
74+ onClicked: {
75+ if (phoneStage.orientation == Qt.PortraitOrientation) {
76+ phoneStage.orientation = Qt.LandscapeOrientation;
77+ } else if (phoneStage.orientation == Qt.LandscapeOrientation) {
78+ phoneStage.orientation = Qt.InvertedPortraitOrientation;
79+ } else if (phoneStage.orientation == Qt.InvertedPortraitOrientation) {
80+ phoneStage.orientation = Qt.InvertedLandscapeOrientation;
81+ } else {
82+ phoneStage.orientation = Qt.PortraitOrientation;
83+ }
84+ }
85+ }
7086 }
7187 ListView {
7288 id: appList
@@ -256,6 +272,46 @@ Item {
256272 compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
257273 }
258274
275+ function test_orientation_change_sent_to_focused_app() {
276+ phoneStage.orientation = Qt.PortraitOrientation;
277+ addApps(1);
278+
279+ var spreadView = findChild(phoneStage, "spreadView");
280+ var app = findChild(spreadView, "appDelegate0");
281+ tryCompare(app, "orientation", Qt.PortraitOrientation);
282+
283+ phoneStage.orientation = Qt.LandscapeOrientation;
284+ tryCompare(app, "orientation", Qt.LandscapeOrientation);
285+ }
286+
287+ function test_orientation_change_not_sent_to_apps_while_spread_open() {
288+ phoneStage.orientation = Qt.PortraitOrientation;
289+ addApps(1);
290+
291+ var spreadView = findChild(phoneStage, "spreadView");
292+ var app = findChild(spreadView, "appDelegate0");
293+ tryCompare(app, "orientation", Qt.PortraitOrientation);
294+
295+ goToSpread();
296+ phoneStage.orientation = Qt.LandscapeOrientation;
297+ tryCompare(app, "orientation", Qt.PortraitOrientation);
298+ }
299+
300+ function test_orientation_change_not_sent_to_unfocused_app_until_it_focused() {
301+ phoneStage.orientation = Qt.PortraitOrientation;
302+ addApps(1);
303+
304+ var spreadView = findChild(phoneStage, "spreadView");
305+ var app = findChild(spreadView, "appDelegate0");
306+
307+ goToSpread();
308+ phoneStage.orientation = Qt.LandscapeOrientation;
309+ tryCompare(app, "orientation", Qt.PortraitOrientation);
310+
311+ phoneStage.select(app.application.appId);
312+ tryCompare(app, "orientation", Qt.LandscapeOrientation);
313+ }
314+
259315 function cleanup() {
260316 while (ApplicationManager.count > 1) {
261317 var oldCount = ApplicationManager.count;
@@ -263,6 +319,7 @@ Item {
263319 ApplicationManager.stopApplication(ApplicationManager.get(closingIndex).appId)
264320 tryCompare(ApplicationManager, "count", oldCount - 1)
265321 }
322+ phoneStage.orientation = Qt.PortraitOrientation;
266323 }
267324 }
268325}