Merge lp:~dandrader/unity8/dontRotateDesktop-lp1515977 into lp:unity8

Proposed by Daniel d'Andrada on 2016-01-14
Status: Merged
Approved by: Michael Zanetti on 2016-01-15
Approved revision: 2137
Merged at revision: 2155
Proposed branch: lp:~dandrader/unity8/dontRotateDesktop-lp1515977
Merge into: lp:unity8
Diff against target: 231 lines (+90/-10)
6 files modified
qml/Shell.qml (+3/-3)
qml/Stages/AbstractStage.qml (+5/-1)
qml/Stages/DesktopStage.qml (+6/-1)
qml/Stages/PhoneStage.qml (+5/-1)
qml/Stages/TabletStage.qml (+5/-1)
tests/qmltests/tst_OrientedShell.qml (+66/-3)
To merge this branch: bzr merge lp:~dandrader/unity8/dontRotateDesktop-lp1515977
Reviewer Review Type Date Requested Status
Michael Zanetti (community) 2016-01-14 Approve on 2016-01-15
PS Jenkins bot continuous-integration Needs Fixing on 2016-01-14
Unity8 CI Bot continuous-integration Approve on 2016-01-14
Review via email: mp+282590@code.launchpad.net

Commit Message

Desktop stage rotates only to follow screen orientation

Description of the Change

* Are there any related MPs required for this MP to build/function as expected? Please list.
No

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

* Did you make sure that your branch does not contain spurious tags?
Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable

* If you changed the UI, has there been a design review?
Not applicable

To post a comment you must log in.
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2136
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/68/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/68/rebuild

review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2136
http://jenkins.qa.ubuntu.com/job/unity8-ci/7067/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6025
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/482/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1772
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/475/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1667
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1667
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/474
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/473
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4652
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6036
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6036/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26652
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/226/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/480
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/480/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26651

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7067/rebuild

review: Needs Fixing (continuous-integration)
Michael Zanetti (mzanetti) wrote :

I've tested it, seems to work fine. code looks ok too.

Jenkins reports some test failures which seem to be related. They also fail locally here. The tested functionality however seems to work from a manual test. So probably a matter of updating the tests themselves.

review: Needs Fixing
2137. By Daniel d'Andrada on 2016-01-14

Reset usageModeSelector on clean up

Daniel d'Andrada (dandrader) wrote :

On 14/01/2016 17:18, Michael Zanetti wrote:
> Review: Needs Fixing
>
> I've tested it, seems to work fine. code looks ok too.
>
> Jenkins reports some test failures which seem to be related. They also fail locally here. The tested functionality however seems to work from a manual test. So probably a matter of updating the tests themselves.

Fixed. Had to reset a control on clean up. So was leaving the
environment "dirty" for the next test.

Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2137
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/78/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/78/rebuild

review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2137
http://jenkins.qa.ubuntu.com/job/unity8-ci/7074/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6037
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/489/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1779
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/482
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1674
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1674
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/481
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/480
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4664
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6048
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6048/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26683
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/233/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/487
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/487/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26684

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7074/rebuild

review: Needs Fixing (continuous-integration)
Michael Zanetti (mzanetti) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?

yes

 * Did CI run pass? If not, please explain why.

as much as it can, yes.

 * Did you make sure that the branch does not contain spurious tags?

yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Shell.qml'
2--- qml/Shell.qml 2015-11-30 11:55:40 +0000
3+++ qml/Shell.qml 2016-01-14 20:00:51 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2013-2015 Canonical, Ltd.
7+ * Copyright (C) 2013-2016 Canonical, Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11@@ -84,8 +84,8 @@
12 return Qt.PrimaryOrientation;
13 } else if (greeter && greeter.shown) {
14 return Qt.PrimaryOrientation;
15- } else if (mainApp) {
16- return shell.orientations.map(mainApp.supportedOrientations);
17+ } else if (applicationsDisplayLoader.item) {
18+ return shell.orientations.map(applicationsDisplayLoader.item.supportedOrientations);
19 } else {
20 // we just don't care
21 return Qt.PortraitOrientation
22
23=== modified file 'qml/Stages/AbstractStage.qml'
24--- qml/Stages/AbstractStage.qml 2015-10-27 21:29:56 +0000
25+++ qml/Stages/AbstractStage.qml 2016-01-14 20:00:51 +0000
26@@ -1,5 +1,5 @@
27 /*
28- * Copyright (C) 2015 Canonical, Ltd.
29+ * Copyright (C) 2015-2016 Canonical, Ltd.
30 *
31 * This program is free software; you can redistribute it and/or modify
32 * it under the terms of the GNU General Public License as published by
33@@ -44,6 +44,10 @@
34 property var mainApp: null
35 property int mainAppWindowOrientationAngle
36 property bool orientationChangesEnabled
37+ property int supportedOrientations: Qt.PortraitOrientation
38+ | Qt.LandscapeOrientation
39+ | Qt.InvertedPortraitOrientation
40+ | Qt.InvertedLandscapeOrientation
41
42 // Shared code for use in stage implementations
43 GSettings {
44
45=== modified file 'qml/Stages/DesktopStage.qml'
46--- qml/Stages/DesktopStage.qml 2016-01-08 13:29:03 +0000
47+++ qml/Stages/DesktopStage.qml 2016-01-14 20:00:51 +0000
48@@ -1,5 +1,5 @@
49 /*
50- * Copyright (C) 2014-2015 Canonical, Ltd.
51+ * Copyright (C) 2014-2016 Canonical, Ltd.
52 *
53 * This program is free software; you can redistribute it and/or modify
54 * it under the terms of the GNU General Public License as published by
55@@ -40,6 +40,11 @@
56 ? ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
57 : null
58
59+ // application windows never rotate independently
60+ mainAppWindowOrientationAngle: shellOrientationAngle
61+
62+ orientationChangesEnabled: true
63+
64 Connections {
65 target: ApplicationManager
66 onApplicationAdded: {
67
68=== modified file 'qml/Stages/PhoneStage.qml'
69--- qml/Stages/PhoneStage.qml 2015-12-03 18:10:39 +0000
70+++ qml/Stages/PhoneStage.qml 2016-01-14 20:00:51 +0000
71@@ -1,5 +1,5 @@
72 /*
73- * Copyright (C) 2014-2015 Canonical, Ltd.
74+ * Copyright (C) 2014-2016 Canonical, Ltd.
75 *
76 * This program is free software; you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License as published by
78@@ -83,6 +83,10 @@
79 && !(priv.focusedAppDelegate && priv.focusedAppDelegate.xBehavior.running)
80 && spreadView.phase === 0
81
82+ supportedOrientations: mainApp ? mainApp.supportedOrientations
83+ : (Qt.PortraitOrientation | Qt.LandscapeOrientation
84+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation)
85+
86 // How far left the stage has been dragged
87 readonly property real dragProgress: spreadRepeater.count > 0 ? -spreadRepeater.itemAt(0).xTranslate : 0
88
89
90=== modified file 'qml/Stages/TabletStage.qml'
91--- qml/Stages/TabletStage.qml 2015-12-03 18:10:39 +0000
92+++ qml/Stages/TabletStage.qml 2016-01-14 20:00:51 +0000
93@@ -1,5 +1,5 @@
94 /*
95- * Copyright (C) 2014-2015 Canonical, Ltd.
96+ * Copyright (C) 2014-2016 Canonical, Ltd.
97 *
98 * This program is free software; you can redistribute it and/or modify
99 * it under the terms of the GNU General Public License as published by
100@@ -72,6 +72,10 @@
101
102 orientationChangesEnabled: priv.mainAppOrientationChangesEnabled
103
104+ supportedOrientations: mainApp ? mainApp.supportedOrientations
105+ : (Qt.PortraitOrientation | Qt.LandscapeOrientation
106+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation)
107+
108 onWidthChanged: {
109 spreadView.selectedIndex = -1;
110 spreadView.phase = 0;
111
112=== modified file 'tests/qmltests/tst_OrientedShell.qml'
113--- tests/qmltests/tst_OrientedShell.qml 2015-12-01 12:17:24 +0000
114+++ tests/qmltests/tst_OrientedShell.qml 2016-01-14 20:00:51 +0000
115@@ -1,5 +1,5 @@
116 /*
117- * Copyright (C) 2015 Canonical, Ltd.
118+ * Copyright (C) 2015-2016 Canonical, Ltd.
119 *
120 * This program is free software; you can redistribute it and/or modify
121 * it under the terms of the GNU General Public License as published by
122@@ -292,6 +292,9 @@
123 activeFocusOnPress: false
124 text: "Usage Mode"
125 model: ["Staged", "Windowed", "Automatic"]
126+ function selectStaged() {selectedIndex = 0;}
127+ function selectWindowed() {selectedIndex = 1;}
128+ function selectAutomatic() {selectedIndex = 2;}
129 }
130 MouseTouchEmulationCheckbox {
131 checked: true
132@@ -393,7 +396,7 @@
133 activeFocusOnPress: false
134 property string prevDevName: "mako"
135 onClicked: {
136- usageModeSelector.selectedIndex = 2; // "Automatic"
137+ usageModeSelector.selectAutomatic();
138
139 if (applicationArguments.deviceName === "desktop") {
140 applicationArguments.deviceName = prevDevName;
141@@ -457,6 +460,8 @@
142 signalSpy.signalName = "";
143
144 LightDM.Greeter.authenticate(""); // reset greeter
145+
146+ usageModeSelector.selectStaged();
147 }
148
149 function cleanup() {
150@@ -997,7 +1002,7 @@
151 }
152
153 function test_attachRemoveInputDevices() {
154- usageModeSelector.selectedIndex = 2;
155+ usageModeSelector.selectAutomatic();
156 tryCompare(mockUnity8Settings, "usageMode", "Automatic")
157
158 loadShell("mako")
159@@ -1140,6 +1145,61 @@
160 tryCompare(shell, "transformRotationAngle" , 0);
161 }
162
163+ /*
164+ Regression test for https://launchpad.net/bugs/1515977
165+
166+ Preconditions:
167+ UI in Desktop mode and landscape
168+
169+ Steps:
170+ - Launch a portrait-only application
171+
172+ Expected outcome:
173+ - Shell stays in landscape
174+
175+ Buggy outcome:
176+ - Shell would rotate to portrait as the newly-focused app doesn't support landscape
177+ */
178+ function test_portraitOnlyAppInLandscapeDesktop_data() {
179+ return [
180+ {tag: "mako", deviceName: "mako"},
181+ {tag: "manta", deviceName: "manta"},
182+ {tag: "flo", deviceName: "flo"}
183+ ];
184+ }
185+ function test_portraitOnlyAppInLandscapeDesktop(data) {
186+ loadShell(data.deviceName);
187+
188+ ////
189+ // setup preconditions (put shell in Desktop mode and landscape)
190+
191+ usageModeSelector.selectWindowed();
192+
193+ orientedShell.physicalOrientation = orientedShell.orientations.landscape;
194+ waitUntilShellIsInOrientation(orientedShell.orientations.landscape);
195+ waitForRotationAnimationsToFinish();
196+
197+ ////
198+ // Launch a portrait-only application
199+
200+ var dialerApp = ApplicationManager.startApplication("dialer-app");
201+ verify(dialerApp);
202+
203+ // ensure the mock dialer-app is as we expect
204+ compare(dialerApp.rotatesWindowContents, false);
205+ compare(dialerApp.supportedOrientations, Qt.PortraitOrientation | Qt.InvertedPortraitOrientation);
206+
207+ waitUntilAppSurfaceShowsUp("dialer-app");
208+ waitUntilAppWindowCanRotate("dialer-app");
209+ verify(isAppSurfaceFocused("dialer-app"));
210+
211+ ////
212+ // check outcome (shell should stay in landscape)
213+
214+ waitForRotationAnimationsToFinish();
215+ compare(shell.orientation, orientedShell.orientations.landscape);
216+ }
217+
218 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
219 function rotateTo(angle) {
220 switch (angle) {
221@@ -1158,7 +1218,10 @@
222 default:
223 verify(false);
224 }
225+ waitForRotationAnimationsToFinish();
226+ }
227
228+ function waitForRotationAnimationsToFinish() {
229 var rotationStates = findInvisibleChild(orientedShell, "rotationStates");
230 verify(rotationStates.d);
231 verify(rotationStates.d.stateUpdateTimer);

Subscribers

People subscribed via source and target branches