Merge lp:~mzanetti/unity8/reversible-spread into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1439
Merged at revision: 1469
Proposed branch: lp:~mzanetti/unity8/reversible-spread
Merge into: lp:unity8
Diff against target: 233 lines (+31/-51)
4 files modified
qml/Stages/PhoneStage.qml (+17/-33)
qml/Stages/TabletStage.qml (+5/-14)
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py (+1/-1)
tests/qmltests/Stages/tst_PhoneStage.qml (+8/-3)
To merge this branch: bzr merge lp:~mzanetti/unity8/reversible-spread
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+241274@code.launchpad.net

Commit message

make spread reversible

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?

n/a

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

change requested by design

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

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

 * Did CI run pass?
Yes

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

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Ok again

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

This introduced a failure in AP:
unity8.application_lifecycle.tests.test_application_lifecycle.ApplicationLifecycleTests.test_app_moves_from_unfocused_to_focused

review: Needs Fixing
1437. By Michael Zanetti

fix ap test

1438. By Michael Zanetti

merge trunk, fix tests that broke with merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1439. By Michael Zanetti

try this

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Stages/PhoneStage.qml'
2--- qml/Stages/PhoneStage.qml 2014-11-25 13:53:45 +0000
3+++ qml/Stages/PhoneStage.qml 2014-12-02 08:45:38 +0000
4@@ -145,16 +145,16 @@
5
6 // Those markers mark the various positions in the spread (ratio to screen width from right to left):
7 // 0 - 1: following finger, snap back to the beginning on release
8- property real positionMarker1: 0.3
9+ property real positionMarker1: 0.2
10 // 1 - 2: curved snapping movement, snap to app 1 on release
11- property real positionMarker2: 0.45
12+ property real positionMarker2: 0.3
13 // 2 - 3: movement follows finger, snaps back to app 1 on release
14- property real positionMarker3: 0.6
15+ property real positionMarker3: 0.35
16 // passing 3, we detach movement from the finger and snap to 4
17 property real positionMarker4: 0.9
18
19 // This is where the first app snaps to when bringing it in from the right edge.
20- property real snapPosition: 0.75
21+ property real snapPosition: 0.7
22
23 // Phase of the animation:
24 // 0: Starting from right edge, a new app (index 1) comes in from the right
25@@ -178,7 +178,7 @@
26 case 1:
27 if (shiftedContentX < width * positionMarker2) {
28 phase = 0;
29- } else if (shiftedContentX >= width * positionMarker4) {
30+ } else if (shiftedContentX >= width * positionMarker4 && !spreadDragArea.dragging) {
31 phase = 2;
32 }
33 break;
34@@ -270,6 +270,7 @@
35
36 Repeater {
37 id: spreadRepeater
38+ objectName: "spreadRepeater"
39 model: ApplicationManager
40 delegate: TransformedSpreadDelegate {
41 id: appDelegate
42@@ -367,8 +368,9 @@
43 if (spreadView.phase == 0 && index < 2) {
44 if (progress < spreadView.positionMarker1) {
45 return progress;
46- } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
47- return spreadView.positionMarker1 + snappingCurve.value * 3;
48+ } else if (progress < spreadView.positionMarker1 + 0.05){
49+ // p : 0.05 = x : pm2
50+ return spreadView.positionMarker1 + (progress - spreadView.positionMarker1) * (spreadView.positionMarker2 - spreadView.positionMarker1) / 0.05
51 } else {
52 return spreadView.positionMarker2;
53 }
54@@ -380,13 +382,6 @@
55 visible: (progress >= 0 && progress < 1.7) ||
56 (isDash && priv.focusedAppDelegate.x !== 0)
57
58- EasingCurve {
59- id: snappingCurve
60- type: EasingCurve.Linear
61- period: 0.05
62- progress: appDelegate.progress - spreadView.positionMarker1
63- }
64-
65 Binding {
66 target: appDelegate
67 property: "orientation"
68@@ -425,16 +420,11 @@
69 id: spreadDragArea
70 objectName: "spreadDragArea"
71 direction: Direction.Leftwards
72- enabled: spreadView.phase != 2 && root.spreadEnabled
73+ enabled: (spreadView.phase != 2 && root.spreadEnabled) || dragging
74
75 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
76 width: root.dragAreaWidth
77
78- // Sitting at the right edge of the screen, this EdgeDragArea directly controls the spreadView when
79- // attachedToView is true. When the finger movement passes positionMarker3 we detach it from the
80- // spreadView and make the spreadView snap to positionMarker4.
81- property bool attachedToView: true
82-
83 property var gesturePoints: new Array()
84
85 onTouchXChanged: {
86@@ -443,15 +433,13 @@
87 spreadView.phase = 0;
88 spreadView.contentX = -spreadView.shift;
89 }
90- if (dragging && status == DirectionalDragArea.Recognized && attachedToView) {
91+ if (dragging && status == DirectionalDragArea.Recognized) {
92 // Gesture recognized. Let's move the spreadView with the finger
93- var finalX = Math.min(touchX + width, width);
94- spreadView.contentX = -finalX + spreadDragArea.width - spreadView.shift;
95- }
96- if (attachedToView && spreadView.shiftedContentX >= spreadView.width * spreadView.positionMarker3) {
97- // We passed positionMarker3. Detach from spreadView and snap it.
98- attachedToView = false;
99- spreadView.snap();
100+ var dragX = Math.min(touchX + width, width); // Prevent dragging rightwards
101+ dragX = -dragX + spreadDragArea.width - spreadView.shift;
102+ // Don't allow dragging further than the animation crossing with phase2's animation
103+ var maxMovement = spreadView.width * spreadView.positionMarker4 - spreadView.shift;
104+ spreadView.contentX = Math.min(dragX, maxMovement);
105 }
106 gesturePoints.push(touchX);
107 }
108@@ -462,10 +450,6 @@
109 onStatusChanged: {
110 previousStatus = currentStatus;
111 currentStatus = status;
112-
113- if (status == DirectionalDragArea.Recognized) {
114- attachedToView = true;
115- }
116 }
117
118 onDraggingChanged: {
119@@ -493,7 +477,7 @@
120 // If it was a short one-way movement, do the Alt+Tab switch
121 // no matter if we didn't cross positionMarker1 yet.
122 spreadView.snapTo(1);
123- } else if (!dragging && attachedToView) {
124+ } else if (!dragging) {
125 // otherwise snap to the closest snap position we can find
126 // (might be back to start, to app 1 or to spread)
127 spreadView.snap();
128
129=== modified file 'qml/Stages/TabletStage.qml'
130--- qml/Stages/TabletStage.qml 2014-11-25 13:53:45 +0000
131+++ qml/Stages/TabletStage.qml 2014-12-02 08:45:38 +0000
132@@ -590,7 +590,6 @@
133 width: root.dragAreaWidth
134 direction: Direction.Leftwards
135
136- property bool attachedToView: false
137 property var gesturePoints: new Array()
138
139 onTouchXChanged: {
140@@ -599,22 +598,14 @@
141 spreadView.contentX = -spreadView.shift;
142 }
143
144- if (dragging && attachedToView) {
145- spreadView.contentX = -touchX + spreadDragArea.width - spreadView.shift;
146- if (spreadView.shiftedContentX > spreadView.phase0Width + spreadView.phase1Width / 2) {
147- attachedToView = false;
148- spreadView.snap();
149- }
150+ if (dragging) {
151+ var dragX = -touchX + spreadDragArea.width - spreadView.shift;
152+ var maxDrag = spreadView.width * spreadView.positionMarker4 - spreadView.shift;
153+ spreadView.contentX = Math.min(dragX, maxDrag);
154 }
155 gesturePoints.push(touchX);
156 }
157
158- onStatusChanged: {
159- if (status == DirectionalDragArea.Recognized) {
160- attachedToView = true;
161- }
162- }
163-
164 onDraggingChanged: {
165 if (dragging) {
166 // Gesture recognized. Start recording this gesture
167@@ -630,7 +621,7 @@
168 // If it was a short one-way movement, do the Alt+Tab switch
169 // no matter if we didn't cross positionMarker1 yet.
170 spreadView.snapTo(spreadView.nextInStack);
171- } else if (!dragging && attachedToView) {
172+ } else if (!dragging) {
173 if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker1) {
174 spreadView.snap();
175 } else if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2) {
176
177=== modified file 'tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py'
178--- tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2014-09-08 10:33:50 +0000
179+++ tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2014-12-02 08:45:38 +0000
180@@ -47,7 +47,7 @@
181 height = self.main_window.height
182 start_x = width
183 start_y = int(height/2)
184- end_x = int(width/2)
185+ end_x = int(width*3/4)
186 end_y = start_y
187
188 logger.info("Swiping screen from the right edge")
189
190=== modified file 'tests/qmltests/Stages/tst_PhoneStage.qml'
191--- tests/qmltests/Stages/tst_PhoneStage.qml 2014-11-13 14:08:31 +0000
192+++ tests/qmltests/Stages/tst_PhoneStage.qml 2014-12-02 08:45:38 +0000
193@@ -128,17 +128,20 @@
194 var startX = phoneStage.width - 2;
195 var startY = phoneStage.height / 2;
196 var endY = startY;
197- var endX = units.gu(2);
198+ var endX = phoneStage.width / 2;
199
200 touchFlick(phoneStage, startX, startY, endX, endY,
201 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
202+
203+ tryCompare(spreadView, "phase", 2);
204+ waitForRendering(phoneStage);
205 }
206
207 function test_shortFlick() {
208 addApps(2)
209 var startX = phoneStage.width - units.gu(1);
210 var startY = phoneStage.height / 2;
211- var endX = phoneStage.width / 2;
212+ var endX = startX - units.gu(4);
213 var endY = startY;
214
215 var activeApp = ApplicationManager.get(0);
216@@ -164,7 +167,7 @@
217 {tag: "<position2 (non-linear)", positionMarker: "positionMarker2", linear: false, offset: -1, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
218 {tag: ">position2", positionMarker: "positionMarker2", linear: true, offset: +1, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
219 {tag: "<position3", positionMarker: "positionMarker3", linear: true, offset: -1, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
220- {tag: ">position3", positionMarker: "positionMarker3", linear: true, offset: +1, endPhase: 2, targetPhase: 2, newFocusedIndex: 2 },
221+ {tag: ">position3", positionMarker: "positionMarker3", linear: true, offset: +1, endPhase: 1, targetPhase: 2, newFocusedIndex: 2 },
222 ];
223 }
224
225@@ -386,6 +389,8 @@
226 compare(dragArea0.enabled, false);
227 compare(dragArea1.enabled, false);
228 compare(dragArea2.enabled, false);
229+
230+ tryCompare(spreadView, "contentX", -spreadView.shift)
231 }
232 }
233 }

Subscribers

People subscribed via source and target branches