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
1=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
2--- src/Ubuntu/Components/plugin/uclistitem.cpp 2016-02-01 18:57:26 +0000
3+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-02-08 11:01:16 +0000
4@@ -1250,6 +1250,8 @@
5 }
6
7 UCStyledItemBase::mouseReleaseEvent(event);
8+ if (!contains(mapFromScene(event->windowPos())))
9+ d->suppressClick = true;
10 d->handleLeftButtonRelease(event);
11 }
12
13
14=== modified file 'tests/unit_x11/tst_components/tst_listitem13.qml'
15--- tests/unit_x11/tst_components/tst_listitem13.qml 2015-12-08 10:34:22 +0000
16+++ tests/unit_x11/tst_components/tst_listitem13.qml 2016-02-08 11:01:16 +0000
17@@ -350,6 +350,21 @@
18 movingSpy.wait();
19 }
20
21+ function test_release_outside() {
22+ var listItem = defaults;
23+ clickSpy.target = listItem;
24+ clickSpy.clear();
25+ highlightedSpy.target = listItem;
26+ highlightedSpy.clear();
27+
28+ mousePress(listItem, listItem.width / 2, listItem.height / 2);
29+ highlightedSpy.wait();
30+ mouseMove(listView, 0, 0, 100);
31+ mouseRelease(listView, 0, 0);
32+ highlightedSpy.wait();
33+ compare(clickSpy.count, 0, "Click must be suppressed when releasing outside of item");
34+ }
35+
36 function test_vertical_listview_move_cancels_highlight_data() {
37 return [
38 {tag: "With touch", mouse: false},
39@@ -360,11 +375,17 @@
40 var listItem = findChild(listView, "listItem0");
41 verify(listItem, "Cannot find listItem0");
42
43+ clickSpy.target = listItem;
44+ clickSpy.clear();
45+ highlightedSpy.target = listItem;
46+ highlightedSpy.clear();
47+
48 // convert positions and use the listView to move
49 var pos = listView.mapFromItem(listItem, listItem.width / 2, 0);
50 if (data.mouse) {
51 // provide slow move
52 mousePress(listView, pos.x, pos.y);
53+ highlightedSpy.wait();
54 for (var i = 1; i < 4; i++) {
55 pos.y += i * units.gu(0.5);
56 mouseMove(listView, pos.x, pos.y, 100);
57@@ -375,6 +396,7 @@
58 // convert pos to point otherwise touch functions will get (0,0) points!!!
59 var pt = Qt.point(pos.x, pos.y);
60 TestExtras.touchPress(0, listView, pt);
61+ highlightedSpy.wait();
62 for (i = 1; i < 4; i++) {
63 pt.y += i * units.gu(0.5);
64 TestExtras.touchMove(0, listView, pt);
65@@ -383,6 +405,7 @@
66 compare(listItem.highlighted, false, "highlighted still!");
67 TestExtras.touchRelease(0, listView, pt);
68 }
69+ compare(clickSpy.count, 0, "Click must be suppressed when releasing outside of item");
70 }
71
72 function test_background_height_change_on_divider_visible() {

Subscribers

People subscribed via source and target branches