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
=== modified file 'qml/Launcher/Launcher.qml'
--- qml/Launcher/Launcher.qml 2015-04-15 20:21:11 +0000
+++ qml/Launcher/Launcher.qml 2015-07-23 07:31:40 +0000
@@ -177,7 +177,8 @@
177 }177 }
178178
179 }179 }
180 MouseArea {180
181 MultiPointTouchArea {
181 id: closeMouseArea182 id: closeMouseArea
182 anchors {183 anchors {
183 left: launcherDragArea.right184 left: launcherDragArea.right
184185
=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
--- tests/qmltests/Launcher/tst_Launcher.qml 2015-04-24 09:53:37 +0000
+++ tests/qmltests/Launcher/tst_Launcher.qml 2015-07-23 07:31:40 +0000
@@ -459,7 +459,14 @@
459 waitUntilLauncherDisappears();459 waitUntilLauncherDisappears();
460 }460 }
461461
462 function test_dragndrop_cancel() {462 function test_dragndrop_cancel_data() {
463 return [
464 {tag: "by mouse", mouse: true},
465 {tag: "by touch", mouse: false}
466 ]
467 }
468
469 function test_dragndrop_cancel(data) {
463 dragLauncherIntoView();470 dragLauncherIntoView();
464 var draggedItem = findChild(launcher, "launcherDelegate4")471 var draggedItem = findChild(launcher, "launcherDelegate4")
465 var item0 = findChild(launcher, "launcherDelegate0")472 var item0 = findChild(launcher, "launcherDelegate0")
@@ -468,22 +475,37 @@
468 // Doing longpress475 // Doing longpress
469 var currentMouseX = draggedItem.width / 2476 var currentMouseX = draggedItem.width / 2
470 var currentMouseY = draggedItem.height / 2477 var currentMouseY = draggedItem.height / 2
471 mousePress(draggedItem, currentMouseX, currentMouseY)478
479 if(data.mouse) {
480 mousePress(draggedItem, currentMouseX, currentMouseY)
481 } else {
482 touchPress(draggedItem, currentMouseX, currentMouseY)
483 }
484
472 // DraggedItem needs to hide and fakeDragItem become visible485 // DraggedItem needs to hide and fakeDragItem become visible
473 tryCompare(draggedItem, "itemOpacity", 0)486 tryCompare(draggedItem, "itemOpacity", 0)
474 tryCompare(fakeDragItem, "visible", true)487 tryCompare(fakeDragItem, "visible", true)
475488
476 // Dragging489 // Dragging
477 currentMouseX -= units.gu(20)490 currentMouseX -= units.gu(20)
478 mouseMove(draggedItem, currentMouseX, currentMouseY)491
492 if(data.mouse) {
493 mouseMove(draggedItem, currentMouseX, currentMouseY)
494 } else {
495 touchMove(draggedItem, currentMouseX, currentMouseY)
496 }
479497
480 // Make sure we're in the dragging state498 // Make sure we're in the dragging state
481 var dndArea = findChild(launcher, "dndArea");499 var dndArea = findChild(launcher, "dndArea");
482 tryCompare(draggedItem, "dragging", true)500 tryCompare(draggedItem, "dragging", true)
483 tryCompare(dndArea, "draggedIndex", 4)501 tryCompare(dndArea, "draggedIndex", 4)
484502
485 // Tap somewhere in the middle of the screen to close/hide the launcher503 // Click/Tap somewhere in the middle of the screen to close/hide the launcher
486 tap(root)504 if(data.mouse) {
505 mouseClick(root)
506 } else {
507 tap(root)
508 }
487509
488 // Make sure the dnd operation has been stopped510 // Make sure the dnd operation has been stopped
489 tryCompare(draggedItem, "dragging", false)511 tryCompare(draggedItem, "dragging", false)
490512
=== modified file 'tests/utils/modules/Unity/Test/UnityTestCase.qml'
--- tests/utils/modules/Unity/Test/UnityTestCase.qml 2015-06-22 12:36:47 +0000
+++ tests/utils/modules/Unity/Test/UnityTestCase.qml 2015-07-23 07:31:40 +0000
@@ -351,6 +351,15 @@
351 event.commit()351 event.commit()
352 }352 }
353353
354 function touchMove(item, tox, toy) {
355 var root = fetchRootItem(item)
356 var rootPoint = item.mapToItem(root, tox, toy)
357
358 var event = touchEvent(item);
359 event.move(0 /* touchId */, rootPoint.x, rootPoint.y);
360 event.commit();
361 }
362
354 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {363 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
355 // Make sure the item is rendered364 // Make sure the item is rendered
356 waitForRendering(item);365 waitForRendering(item);

Subscribers

People subscribed via source and target branches