Merge lp:~feng-kylin/unity8/cantClickOnDashWhileDraggingAnIcon into lp:unity8

Proposed by handsome_feng
Status: Merged
Approved by: Michael Zanetti
Approved revision: 1836
Merged at revision: 1909
Proposed branch: lp:~feng-kylin/unity8/cantClickOnDashWhileDraggingAnIcon
Merge into: lp:unity8
Diff against target: 95 lines (+38/-6)
3 files modified
qml/Launcher/Launcher.qml (+2/-1)
tests/qmltests/Launcher/tst_Launcher.qml (+27/-5)
tests/utils/modules/Unity/Test/UnityTestCase.qml (+9/-0)
To merge this branch: bzr merge lp:~feng-kylin/unity8/cantClickOnDashWhileDraggingAnIcon
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Andrea Cimitan (community) Needs Fixing
Review via email: mp+262941@code.launchpad.net

Commit message

Convert the MouseArea to MultiPointTouchArea to track multiple touch points.

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
Andrea Cimitan (cimi) wrote :

Feels like we should add a small qml test for that!

review: Needs Fixing
1833. By handsome_feng

add a qml test

Revision history for this message
handsome_feng (feng-kylin) wrote :

To be honest, I think the function test_dragndrop_cancel() has already test this, but it is weird that the "tap(root)" can cancel the dragging rather than reach the dash.

1834. By handsome_feng

remove the qml test

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

Ok. I've investigated a bit here:

The reason why test_dragndrop_cancel fails to catch the bug seems to be that the test uses a mouse device to start the drag and drop operation. Then the tap(root) uses a touch. However, as there's no prior touch ongoing the MouseArea (only being capable of one finger) still catches it. In the real world the drag gesture is done with a touch too, so the tap is activated for the second finger and fails to trigger the MouseArea.

Also, turns out that converting the existing MouseArea to a MultiPointTouchArea is enough to fix the bug. No need to have a MouseArea and a MultiPointTouchArea.

For the test I think it would make sense to change the drag'n'drop to be performed with touch input too. Maybe we could add a _data() function that does the test once with touch and once with mouse.

What do you think?

Revision history for this message
handsome_feng (feng-kylin) wrote :

> Also, turns out that converting the existing MouseArea to a
> MultiPointTouchArea is enough to fix the bug. No need to have a MouseArea and
> a MultiPointTouchArea.

Simply converting the MouseArea to MultiPointTouchArea will lead to a problem that
when running unity8 with argument "-mousetouch", it needs click twice to dismiss
the Launcher. Maybe something wrong between MouseTouchAdaptor and MultiPointTouchArea?
:/

> For the test I think it would make sense to change the drag'n'drop to be
> performed with touch input too. Maybe we could add a _data() function that
> does the test once with touch and once with mouse.

yeah, I have done it.

1835. By handsome_feng

merge trunk

1836. By handsome_feng

update the test_dragndrop_cancel function

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

You should update the commit message.

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

Thanks a lot!

 * 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.

not running on non-team-members. I've ran launcher tests manually, they're passing

 * 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/Launcher/Launcher.qml'
2--- qml/Launcher/Launcher.qml 2015-04-15 20:21:11 +0000
3+++ qml/Launcher/Launcher.qml 2015-07-23 07:31:40 +0000
4@@ -177,7 +177,8 @@
5 }
6
7 }
8- MouseArea {
9+
10+ MultiPointTouchArea {
11 id: closeMouseArea
12 anchors {
13 left: launcherDragArea.right
14
15=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
16--- tests/qmltests/Launcher/tst_Launcher.qml 2015-04-24 09:53:37 +0000
17+++ tests/qmltests/Launcher/tst_Launcher.qml 2015-07-23 07:31:40 +0000
18@@ -459,7 +459,14 @@
19 waitUntilLauncherDisappears();
20 }
21
22- function test_dragndrop_cancel() {
23+ function test_dragndrop_cancel_data() {
24+ return [
25+ {tag: "by mouse", mouse: true},
26+ {tag: "by touch", mouse: false}
27+ ]
28+ }
29+
30+ function test_dragndrop_cancel(data) {
31 dragLauncherIntoView();
32 var draggedItem = findChild(launcher, "launcherDelegate4")
33 var item0 = findChild(launcher, "launcherDelegate0")
34@@ -468,22 +475,37 @@
35 // Doing longpress
36 var currentMouseX = draggedItem.width / 2
37 var currentMouseY = draggedItem.height / 2
38- mousePress(draggedItem, currentMouseX, currentMouseY)
39+
40+ if(data.mouse) {
41+ mousePress(draggedItem, currentMouseX, currentMouseY)
42+ } else {
43+ touchPress(draggedItem, currentMouseX, currentMouseY)
44+ }
45+
46 // DraggedItem needs to hide and fakeDragItem become visible
47 tryCompare(draggedItem, "itemOpacity", 0)
48 tryCompare(fakeDragItem, "visible", true)
49
50 // Dragging
51 currentMouseX -= units.gu(20)
52- mouseMove(draggedItem, currentMouseX, currentMouseY)
53+
54+ if(data.mouse) {
55+ mouseMove(draggedItem, currentMouseX, currentMouseY)
56+ } else {
57+ touchMove(draggedItem, currentMouseX, currentMouseY)
58+ }
59
60 // Make sure we're in the dragging state
61 var dndArea = findChild(launcher, "dndArea");
62 tryCompare(draggedItem, "dragging", true)
63 tryCompare(dndArea, "draggedIndex", 4)
64
65- // Tap somewhere in the middle of the screen to close/hide the launcher
66- tap(root)
67+ // Click/Tap somewhere in the middle of the screen to close/hide the launcher
68+ if(data.mouse) {
69+ mouseClick(root)
70+ } else {
71+ tap(root)
72+ }
73
74 // Make sure the dnd operation has been stopped
75 tryCompare(draggedItem, "dragging", false)
76
77=== modified file 'tests/utils/modules/Unity/Test/UnityTestCase.qml'
78--- tests/utils/modules/Unity/Test/UnityTestCase.qml 2015-06-22 12:36:47 +0000
79+++ tests/utils/modules/Unity/Test/UnityTestCase.qml 2015-07-23 07:31:40 +0000
80@@ -351,6 +351,15 @@
81 event.commit()
82 }
83
84+ function touchMove(item, tox, toy) {
85+ var root = fetchRootItem(item)
86+ var rootPoint = item.mapToItem(root, tox, toy)
87+
88+ var event = touchEvent(item);
89+ event.move(0 /* touchId */, rootPoint.x, rootPoint.y);
90+ event.commit();
91+ }
92+
93 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
94 // Make sure the item is rendered
95 waitForRendering(item);

Subscribers

People subscribed via source and target branches