Merge lp:~mzanetti/unity8/fix-dnd-cancelling into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1734
Merged at revision: 1740
Proposed branch: lp:~mzanetti/unity8/fix-dnd-cancelling
Merge into: lp:unity8
Diff against target: 64 lines (+37/-3)
2 files modified
qml/Launcher/LauncherPanel.qml (+5/-3)
tests/qmltests/Launcher/tst_Launcher.qml (+32/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/fix-dnd-cancelling
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+256462@code.launchpad.net

Commit message

Make sure dnd mode is ended properly when drag gesture is cancelled

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?
n/a

To post a comment you must log in.
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 :

On second drag of the same item (after it was cancelled) the item is not under my finger but seems to be displaced by the old position it was in.

review: Needs Fixing
1732. By Michael Zanetti

also reset drag.target

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

Still needs some work, i was doing a vertical move of the dragged icon while doing the horizontal swipe in the greeter to cancel it and ended up with this

http://imgur.com/87eRnos

review: Needs Fixing
1733. By Michael Zanetti

do the full endDrag procedure in case of a cancel

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Still needs some work, i was doing a vertical move of the dragged icon while
> doing the horizontal swipe in the greeter to cancel it and ended up with this
>
> http://imgur.com/87eRnos

Should be fixed now. I can't repro it any more.

1734. By Michael Zanetti

coding style

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?
They passed locally, waiting for CI before top approving

 * 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/Launcher/LauncherPanel.qml'
2--- qml/Launcher/LauncherPanel.qml 2015-02-05 14:03:32 +0000
3+++ qml/Launcher/LauncherPanel.qml 2015-04-17 13:31:44 +0000
4@@ -338,12 +338,14 @@
5 }
6
7 onCanceled: {
8- selectedItem = undefined;
9- preDragging = false;
10- postDragging = false;
11+ endDrag();
12 }
13
14 onReleased: {
15+ endDrag();
16+ }
17+
18+ function endDrag() {
19 var droppedIndex = draggedIndex;
20 if (dragging) {
21 postDragging = true;
22
23=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
24--- tests/qmltests/Launcher/tst_Launcher.qml 2015-03-13 14:32:45 +0000
25+++ tests/qmltests/Launcher/tst_Launcher.qml 2015-04-17 13:31:44 +0000
26@@ -459,6 +459,38 @@
27 waitUntilLauncherDisappears();
28 }
29
30+ function test_dragndrop_cancel() {
31+ dragLauncherIntoView();
32+ var draggedItem = findChild(launcher, "launcherDelegate4")
33+ var item0 = findChild(launcher, "launcherDelegate0")
34+ var fakeDragItem = findChild(launcher, "fakeDragItem")
35+
36+ // Doing longpress
37+ var currentMouseX = draggedItem.width / 2
38+ var currentMouseY = draggedItem.height / 2
39+ mousePress(draggedItem, currentMouseX, currentMouseY)
40+ // DraggedItem needs to hide and fakeDragItem become visible
41+ tryCompare(draggedItem, "itemOpacity", 0)
42+ tryCompare(fakeDragItem, "visible", true)
43+
44+ // Dragging
45+ currentMouseX -= units.gu(20)
46+ mouseMove(draggedItem, currentMouseX, currentMouseY)
47+
48+ // Make sure we're in the dragging state
49+ var dndArea = findChild(launcher, "dndArea");
50+ tryCompare(draggedItem, "dragging", true)
51+ tryCompare(dndArea, "draggedIndex", 4)
52+
53+ // Tap somewhere in the middle of the screen to close/hide the launcher
54+ tap(root)
55+
56+ // Make sure the dnd operation has been stopped
57+ tryCompare(draggedItem, "dragging", false)
58+ tryCompare(dndArea, "draggedIndex", -1)
59+ tryCompare(dndArea, "drag.target", undefined)
60+ }
61+
62 function test_quicklist_dismiss() {
63 dragLauncherIntoView();
64 var draggedItem = findChild(launcher, "launcherDelegate5")

Subscribers

People subscribed via source and target branches