Merge lp:~cimi/unity8/elastic-not-close-spread into lp:unity8

Proposed by Andrea Cimitan
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1462
Merged at revision: 1471
Proposed branch: lp:~cimi/unity8/elastic-not-close-spread
Merge into: lp:unity8
Diff against target: 55 lines (+16/-6)
2 files modified
qml/Stages/SpreadDelegate.qml (+8/-1)
tests/qmltests/Stages/tst_SpreadDelegate.qml (+8/-5)
To merge this branch: bzr merge lp:~cimi/unity8/elastic-not-close-spread
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+242949@code.launchpad.net

Commit message

Different drag behaviour for not closable apps in spread

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?
tomorrow morning

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1461. By Andrea Cimitan

Tweaked limit as design requested

1462. By Andrea Cimitan

Fix test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (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?
Flacky unlrelated autopilot

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Stages/SpreadDelegate.qml'
2--- qml/Stages/SpreadDelegate.qml 2014-11-20 13:02:53 +0000
3+++ qml/Stages/SpreadDelegate.qml 2014-11-27 11:22:18 +0000
4@@ -41,10 +41,17 @@
5 Item {
6 objectName: "appWindowWithShadow"
7
8- y: dragArea.distance
9+ readonly property real limit: root.height / 4
10+
11+ y: root.closeable ? dragArea.distance : elastic(dragArea.distance)
12 width: parent.width
13 height: parent.height
14
15+ function elastic(distance) {
16+ var k = distance < 0 ? -limit : limit
17+ return k * (1 - Math.pow((k - 1) / k, distance))
18+ }
19+
20 BorderImage {
21 anchors {
22 fill: appWindow
23
24=== modified file 'tests/qmltests/Stages/tst_SpreadDelegate.qml'
25--- tests/qmltests/Stages/tst_SpreadDelegate.qml 2014-11-24 10:26:58 +0000
26+++ tests/qmltests/Stages/tst_SpreadDelegate.qml 2014-11-27 11:22:18 +0000
27@@ -110,7 +110,7 @@
28 {tag: "swipeToClose=true closeable=true -> appWindow moves away",
29 swipeToClose: true, closeable: true },
30
31- {tag: "swipeToClose=true closeable=alse -> appWindow bounces back",
32+ {tag: "swipeToClose=true closeable=false -> appWindow bounces back",
33 swipeToClose: true, closeable: false },
34
35 {tag: "swipeToClose=false -> appWindow stays put",
36@@ -134,13 +134,16 @@
37 touchX /* fromX */, fromY, touchX /* toX */, toY,
38 true /* beginTouch */, false /* endTouch */, dragArea.minSpeedToClose * 1.1 /* speed */);
39
40-
41 if (data.swipeToClose) {
42 verify(appWindowWithShadow.y < 0);
43 var threshold = findChild(spreadDelegateLoader.item, "dragArea").threshold
44- // Verify that the delegate started moving exactly "threshold" after the finger movement
45- // and did not jump up to the finger, but lags the threshold behind
46- compare(Math.abs(Math.abs(appWindowWithShadow.y) - dragDistance), threshold);
47+ if (data.closeable) {
48+ // Verify that the delegate started moving exactly "threshold" after the finger movement
49+ // and did not jump up to the finger, but lags the threshold behind
50+ compare(Math.abs(Math.abs(appWindowWithShadow.y) - dragDistance), threshold);
51+ } else {
52+ verify(Math.abs(Math.abs(appWindowWithShadow.y) - dragDistance) > threshold);
53+ }
54
55 touchRelease(spreadDelegateLoader.item, touchX, toY - units.gu(1));
56

Subscribers

People subscribed via source and target branches