Merge lp:~dandrader/unity8/phone-lock-landscape into lp:unity8

Proposed by Daniel d'Andrada on 2015-07-09
Status: Merged
Approved by: Michael Zanetti on 2015-07-10
Approved revision: 1850
Merged at revision: 1853
Proposed branch: lp:~dandrader/unity8/phone-lock-landscape
Merge into: lp:unity8
Diff against target: 110 lines (+62/-2)
3 files modified
qml/Shell.qml (+1/-1)
qml/Stages/PhoneStage.qml (+16/-1)
tests/qmltests/tst_OrientedShell.qml (+45/-0)
To merge this branch: bzr merge lp:~dandrader/unity8/phone-lock-landscape
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2015-07-10
Michael Zanetti (community) 2015-07-09 Approve on 2015-07-10
Review via email: mp+264300@code.launchpad.net

Commit Message

Dismiss the apps spread if greeter gets shown

Enables Shell to rotate itself back into place while greeter is shown because PhoneStage doesn't allow rotations while the apps spread is open

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.
1850. By Daniel d'Andrada on 2015-07-10

Dismiss the apps spread if greeter gets shown

Enables Shell to rotate itself back into place while greeter is shown because
PhoneStage doesn't allow rotations while the apps spread is open

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.

waiting. I've ran involved tests. seem to pass.

 * 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-06-23 17:40:03 +0000
3+++ qml/Shell.qml 2015-07-10 15:17:19 +0000
4@@ -305,7 +305,7 @@
5 Binding {
6 target: applicationsDisplayLoader.item
7 property: "spreadEnabled"
8- value: tutorial.spreadEnabled && (!greeter || !greeter.hasLockedApp)
9+ value: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
10 }
11 Binding {
12 target: applicationsDisplayLoader.item
13
14=== modified file 'qml/Stages/PhoneStage.qml'
15--- qml/Stages/PhoneStage.qml 2015-06-23 14:20:23 +0000
16+++ qml/Stages/PhoneStage.qml 2015-07-10 15:17:19 +0000
17@@ -51,6 +51,14 @@
18 spreadView.contentX = -spreadView.shift;
19 }
20 }
21+ onSpreadEnabledChanged: {
22+ if (!spreadEnabled) {
23+ // reset. go back to display the focused app
24+ spreadView.selectedIndex = -1;
25+ spreadView.phase = 0;
26+ spreadView.contentX = -spreadView.shift;
27+ }
28+ }
29 function updateFocusedAppOrientation() {
30 if (spreadRepeater.count > 0) {
31 spreadRepeater.itemAt(0).matchShellOrientation();
32@@ -281,7 +289,13 @@
33
34 switch (phase) {
35 case 0:
36- if (shiftedContentX > width * positionMarker2) {
37+ // the "spreadEnabled" part is because when code does "phase = 0; contentX = -shift" to
38+ // dismiss the spread because spreadEnabled went to false, for some reason, during tests,
39+ // Flickable might jump in and change contentX value back, causing the code below to do
40+ // "phase = 1" which will make the spread stay.
41+ // It sucks that we have no control whatsoever over whether or when Flickable animates its
42+ // contentX.
43+ if (root.spreadEnabled && shiftedContentX > width * positionMarker2) {
44 phase = 1;
45 }
46 break;
47@@ -456,6 +470,7 @@
48 enabled: root.spreadEnabled &&
49 !spreadView.active &&
50 !snapAnimation.running &&
51+ !spreadDragArea.pressed &&
52 priv.animateX &&
53 !root.beingResized
54 UbuntuNumberAnimation {
55
56=== modified file 'tests/qmltests/tst_OrientedShell.qml'
57--- tests/qmltests/tst_OrientedShell.qml 2015-06-23 17:40:03 +0000
58+++ tests/qmltests/tst_OrientedShell.qml 2015-07-10 15:17:19 +0000
59@@ -951,6 +951,51 @@
60 tryCompare(mockOskSettings, "stayHidden", false);
61 }
62
63+ /*
64+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1471609
65+
66+ Steps:
67+ - Open an app which can rotate
68+ - Rotate the phone to landscape
69+ - Open the app spread
70+ - Press the power button while the app spread is open
71+ - Wait a bit and press power button again
72+
73+ Expected outcome:
74+ You see greeter in portrat (ie, primary orientation)
75+
76+ Actual outcome:
77+ You see greeter in landscape
78+
79+ Comments:
80+ Greeter supports only the primary orientation (portrait in phones) but
81+ the stage doesn't allow orientation changes while the apps spread is open,
82+ hence the bug.
83+ */
84+ function test_phoneWithSpreadInLandscapeWhenGreeterShowsUp() {
85+ loadShell("mako");
86+
87+ var gmailApp = ApplicationManager.startApplication("gmail-webapp");
88+ verify(gmailApp);
89+
90+ // ensure the mock gmail-webapp is as we expect
91+ compare(gmailApp.rotatesWindowContents, false);
92+ compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
93+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
94+
95+ // wait until it's able to rotate
96+ tryCompare(shell, "orientationChangesEnabled", true);
97+
98+ rotateTo(90);
99+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle + 90);
100+
101+ performEdgeSwipeToShowAppSpread();
102+
103+ showGreeter();
104+
105+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
106+ }
107+
108 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
109 function rotateTo(angle) {
110 switch (angle) {

Subscribers

People subscribed via source and target branches