Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/suppressClickOutsideItem into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1832
Merged at revision: 1838
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/suppressClickOutsideItem
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 72 lines (+25/-0)
2 files modified
src/Ubuntu/Components/plugin/uclistitem.cpp (+2/-0)
tests/unit_x11/tst_components/tst_listitem13.qml (+23/-0)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/suppressClickOutsideItem
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+285094@code.launchpad.net

Commit message

Suppress click signal if releasing outside of ListItem

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
1832. By Cris Dywan

Main release should not use contentItem coordinates

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Sneaky clean fix, thanks!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
--- src/Ubuntu/Components/plugin/uclistitem.cpp 2016-02-01 18:57:26 +0000
+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-02-08 11:01:16 +0000
@@ -1250,6 +1250,8 @@
1250 }1250 }
12511251
1252 UCStyledItemBase::mouseReleaseEvent(event);1252 UCStyledItemBase::mouseReleaseEvent(event);
1253 if (!contains(mapFromScene(event->windowPos())))
1254 d->suppressClick = true;
1253 d->handleLeftButtonRelease(event);1255 d->handleLeftButtonRelease(event);
1254}1256}
12551257
12561258
=== modified file 'tests/unit_x11/tst_components/tst_listitem13.qml'
--- tests/unit_x11/tst_components/tst_listitem13.qml 2015-12-08 10:34:22 +0000
+++ tests/unit_x11/tst_components/tst_listitem13.qml 2016-02-08 11:01:16 +0000
@@ -350,6 +350,21 @@
350 movingSpy.wait();350 movingSpy.wait();
351 }351 }
352352
353 function test_release_outside() {
354 var listItem = defaults;
355 clickSpy.target = listItem;
356 clickSpy.clear();
357 highlightedSpy.target = listItem;
358 highlightedSpy.clear();
359
360 mousePress(listItem, listItem.width / 2, listItem.height / 2);
361 highlightedSpy.wait();
362 mouseMove(listView, 0, 0, 100);
363 mouseRelease(listView, 0, 0);
364 highlightedSpy.wait();
365 compare(clickSpy.count, 0, "Click must be suppressed when releasing outside of item");
366 }
367
353 function test_vertical_listview_move_cancels_highlight_data() {368 function test_vertical_listview_move_cancels_highlight_data() {
354 return [369 return [
355 {tag: "With touch", mouse: false},370 {tag: "With touch", mouse: false},
@@ -360,11 +375,17 @@
360 var listItem = findChild(listView, "listItem0");375 var listItem = findChild(listView, "listItem0");
361 verify(listItem, "Cannot find listItem0");376 verify(listItem, "Cannot find listItem0");
362377
378 clickSpy.target = listItem;
379 clickSpy.clear();
380 highlightedSpy.target = listItem;
381 highlightedSpy.clear();
382
363 // convert positions and use the listView to move383 // convert positions and use the listView to move
364 var pos = listView.mapFromItem(listItem, listItem.width / 2, 0);384 var pos = listView.mapFromItem(listItem, listItem.width / 2, 0);
365 if (data.mouse) {385 if (data.mouse) {
366 // provide slow move386 // provide slow move
367 mousePress(listView, pos.x, pos.y);387 mousePress(listView, pos.x, pos.y);
388 highlightedSpy.wait();
368 for (var i = 1; i < 4; i++) {389 for (var i = 1; i < 4; i++) {
369 pos.y += i * units.gu(0.5);390 pos.y += i * units.gu(0.5);
370 mouseMove(listView, pos.x, pos.y, 100);391 mouseMove(listView, pos.x, pos.y, 100);
@@ -375,6 +396,7 @@
375 // convert pos to point otherwise touch functions will get (0,0) points!!!396 // convert pos to point otherwise touch functions will get (0,0) points!!!
376 var pt = Qt.point(pos.x, pos.y);397 var pt = Qt.point(pos.x, pos.y);
377 TestExtras.touchPress(0, listView, pt);398 TestExtras.touchPress(0, listView, pt);
399 highlightedSpy.wait();
378 for (i = 1; i < 4; i++) {400 for (i = 1; i < 4; i++) {
379 pt.y += i * units.gu(0.5);401 pt.y += i * units.gu(0.5);
380 TestExtras.touchMove(0, listView, pt);402 TestExtras.touchMove(0, listView, pt);
@@ -383,6 +405,7 @@
383 compare(listItem.highlighted, false, "highlighted still!");405 compare(listItem.highlighted, false, "highlighted still!");
384 TestExtras.touchRelease(0, listView, pt);406 TestExtras.touchRelease(0, listView, pt);
385 }407 }
408 compare(clickSpy.count, 0, "Click must be suppressed when releasing outside of item");
386 }409 }
387410
388 function test_background_height_change_on_divider_visible() {411 function test_background_height_change_on_divider_visible() {

Subscribers

People subscribed via source and target branches