Merge lp:~fboucault/ubuntu-ui-toolkit/list_item_swipe_position into lp:ubuntu-ui-toolkit/staging
- list_item_swipe_position
- Merge into staging
Status: | Needs review |
---|---|
Proposed branch: | lp:~fboucault/ubuntu-ui-toolkit/list_item_swipe_position |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
277 lines (+108/-20) 5 files modified
components.api (+1/-0) src/UbuntuToolkit/uclistitem.cpp (+54/-0) src/UbuntuToolkit/uclistitem_p.h (+4/-0) tests/unit/visual/tst_listitem.13.qml (+21/-8) tests/unit/visual/tst_listitem_extras.13.qml (+28/-12) |
To merge this branch: | bzr merge lp:~fboucault/ubuntu-ui-toolkit/list_item_swipe_position |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Needs Fixing | |
Zsombor Egri | Approve | ||
Review via email: mp+308495@code.launchpad.net |
Commit message
Added new property to ListItem: real swipePosition
Description of the change
Added new property to ListItem: real swipePosition
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2144
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Zsombor Egri (zsombi) wrote : | # |
Looks good, krillin is again OoO :/ Hopefully autolanding will get it.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2144
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Unmerged revisions
- 2144. By Florian Boucault
-
Fix some unit tests
- 2143. By Florian Boucault
-
Added basic unit tests for ListItem.
swipePosition - 2142. By Florian Boucault
-
Added more unit tests for ListItem.
swipePosition - 2141. By Florian Boucault
-
Added new property to API
- 2140. By Florian Boucault
-
Preliminary implementation of ListItem:
:swipePosition
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2016-09-17 05:48:25 +0000 | |||
3 | +++ components.api 2016-10-14 12:12:03 +0000 | |||
4 | @@ -612,6 +612,7 @@ | |||
5 | 612 | property bool selectMode | 612 | property bool selectMode |
6 | 613 | property bool selected | 613 | property bool selected |
7 | 614 | property bool swipeEnabled 1.3 | 614 | property bool swipeEnabled 1.3 |
8 | 615 | property double swipePosition 1.3 | ||
9 | 615 | readonly property bool swiped 1.3 | 616 | readonly property bool swiped 1.3 |
10 | 616 | property ListItemActions trailingActions | 617 | property ListItemActions trailingActions |
11 | 617 | Ubuntu.Components.ListItemActions 1.2 UCListItemActions: QtObject | 618 | Ubuntu.Components.ListItemActions 1.2 UCListItemActions: QtObject |
12 | 618 | 619 | ||
13 | === modified file 'src/UbuntuToolkit/uclistitem.cpp' | |||
14 | --- src/UbuntuToolkit/uclistitem.cpp 2016-09-20 06:24:44 +0000 | |||
15 | +++ src/UbuntuToolkit/uclistitem.cpp 2016-10-14 12:12:03 +0000 | |||
16 | @@ -509,6 +509,8 @@ | |||
17 | 509 | if (event.m_contentPos != contentItem->position()) { | 509 | if (event.m_contentPos != contentItem->position()) { |
18 | 510 | contentItem->setPosition(event.m_contentPos); | 510 | contentItem->setPosition(event.m_contentPos); |
19 | 511 | lastPos = localPos; | 511 | lastPos = localPos; |
20 | 512 | Q_Q(UCListItem); | ||
21 | 513 | q->swipePositionChanged(); | ||
22 | 512 | if (status == UCSwipeEvent::Updated) { | 514 | if (status == UCSwipeEvent::Updated) { |
23 | 513 | setContentMoving(true); | 515 | setContentMoving(true); |
24 | 514 | setSwiped(true); | 516 | setSwiped(true); |
25 | @@ -2009,6 +2011,58 @@ | |||
26 | 2009 | } | 2011 | } |
27 | 2010 | 2012 | ||
28 | 2011 | /*! | 2013 | /*! |
29 | 2014 | * \qmlproperty bool ListItem::swipePosition | ||
30 | 2015 | * \since Ubuntu.Components 1.3 | ||
31 | 2016 | * The property controls the swiping of the leading- or trailing actions. This | ||
32 | 2017 | * is useful when swiping needs to be triggered programatically, for example | ||
33 | 2018 | * when demonstrating that actions are present and can be swiped. | ||
34 | 2019 | * \qml | ||
35 | 2020 | * import QtQuick 2.4 | ||
36 | 2021 | * import Ubuntu.Components 1.3 | ||
37 | 2022 | * | ||
38 | 2023 | * ListItem { | ||
39 | 2024 | * id: listItem | ||
40 | 2025 | * | ||
41 | 2026 | * leadingActions: ListItemActions { | ||
42 | 2027 | * actions: [ | ||
43 | 2028 | * Action { | ||
44 | 2029 | * iconName: "delete" | ||
45 | 2030 | * } | ||
46 | 2031 | * ] | ||
47 | 2032 | * } | ||
48 | 2033 | * | ||
49 | 2034 | * UbuntuNumberAnimation { | ||
50 | 2035 | * target: listItem | ||
51 | 2036 | * property: "swipePosition" | ||
52 | 2037 | * to: units.gu(8) | ||
53 | 2038 | * } | ||
54 | 2039 | * } | ||
55 | 2040 | * \endqml | ||
56 | 2041 | */ | ||
57 | 2042 | qreal UCListItem::swipePosition() const | ||
58 | 2043 | { | ||
59 | 2044 | Q_D(const UCListItem); | ||
60 | 2045 | return d->contentItem->position().x(); | ||
61 | 2046 | } | ||
62 | 2047 | void UCListItem::setSwipePosition(qreal swipePosition) | ||
63 | 2048 | { | ||
64 | 2049 | Q_D(UCListItem); | ||
65 | 2050 | if (!d->leadingActions || !d->trailingActions) { | ||
66 | 2051 | return; | ||
67 | 2052 | } | ||
68 | 2053 | if (d->contentItem->position().x() == swipePosition) { | ||
69 | 2054 | return; | ||
70 | 2055 | } | ||
71 | 2056 | |||
72 | 2057 | d->setSwiped(true); | ||
73 | 2058 | d->lockContentItem(false); | ||
74 | 2059 | d->loadStyleItem(); | ||
75 | 2060 | d->lastPos = QPointF(0.0, 0.0); | ||
76 | 2061 | QPointF localPos(swipePosition, 0.0); | ||
77 | 2062 | d->swipeEvent(localPos, UCSwipeEvent::Updated); | ||
78 | 2063 | } | ||
79 | 2064 | |||
80 | 2065 | /*! | ||
81 | 2012 | * \qmlproperty bool ListItem::swiped | 2066 | * \qmlproperty bool ListItem::swiped |
82 | 2013 | * \readonly | 2067 | * \readonly |
83 | 2014 | * \since Ubuntu.Components 1.3 | 2068 | * \since Ubuntu.Components 1.3 |
84 | 2015 | 2069 | ||
85 | === modified file 'src/UbuntuToolkit/uclistitem_p.h' | |||
86 | --- src/UbuntuToolkit/uclistitem_p.h 2016-09-16 05:01:13 +0000 | |||
87 | +++ src/UbuntuToolkit/uclistitem_p.h 2016-10-14 12:12:03 +0000 | |||
88 | @@ -66,6 +66,7 @@ | |||
89 | 66 | #endif | 66 | #endif |
90 | 67 | Q_PROPERTY(bool swipeEnabled READ isSwipeEnabled WRITE setSwipeEnabled NOTIFY swipeEnabledChanged FINAL REVISION 1) | 67 | Q_PROPERTY(bool swipeEnabled READ isSwipeEnabled WRITE setSwipeEnabled NOTIFY swipeEnabledChanged FINAL REVISION 1) |
91 | 68 | Q_PROPERTY(bool swiped READ isSwiped NOTIFY swipedChanged FINAL REVISION 1) | 68 | Q_PROPERTY(bool swiped READ isSwiped NOTIFY swipedChanged FINAL REVISION 1) |
92 | 69 | Q_PROPERTY(qreal swipePosition READ swipePosition WRITE setSwipePosition NOTIFY swipePositionChanged FINAL REVISION 1) | ||
93 | 69 | public: | 70 | public: |
94 | 70 | explicit UCListItem(QQuickItem *parent = 0); | 71 | explicit UCListItem(QQuickItem *parent = 0); |
95 | 71 | ~UCListItem(); | 72 | ~UCListItem(); |
96 | @@ -89,6 +90,8 @@ | |||
97 | 89 | UCListItemExpansion *expansion(); | 90 | UCListItemExpansion *expansion(); |
98 | 90 | bool isSwipeEnabled() const; | 91 | bool isSwipeEnabled() const; |
99 | 91 | void setSwipeEnabled(bool swipeEnabled); | 92 | void setSwipeEnabled(bool swipeEnabled); |
100 | 93 | qreal swipePosition() const; | ||
101 | 94 | void setSwipePosition(qreal swipePosition); | ||
102 | 92 | bool isSwiped(); | 95 | bool isSwiped(); |
103 | 93 | 96 | ||
104 | 94 | protected: | 97 | protected: |
105 | @@ -123,6 +126,7 @@ | |||
106 | 123 | void listItemChildrenChanged(); | 126 | void listItemChildrenChanged(); |
107 | 124 | Q_REVISION(1) void swipeEnabledChanged(); | 127 | Q_REVISION(1) void swipeEnabledChanged(); |
108 | 125 | Q_REVISION(1) void swipedChanged(); | 128 | Q_REVISION(1) void swipedChanged(); |
109 | 129 | Q_REVISION(1) void swipePositionChanged(); | ||
110 | 126 | 130 | ||
111 | 127 | void clicked(); | 131 | void clicked(); |
112 | 128 | void pressAndHold(); | 132 | void pressAndHold(); |
113 | 129 | 133 | ||
114 | === modified file 'tests/unit/visual/tst_listitem.13.qml' | |||
115 | --- tests/unit/visual/tst_listitem.13.qml 2016-10-06 11:22:26 +0000 | |||
116 | +++ tests/unit/visual/tst_listitem.13.qml 2016-10-14 12:12:03 +0000 | |||
117 | @@ -263,6 +263,7 @@ | |||
118 | 263 | compare(defaults.__styleInstance, null, "__styleInstance must be null."); | 263 | compare(defaults.__styleInstance, null, "__styleInstance must be null."); |
119 | 264 | compare(defaults.selected, false, "Not selected by default"); | 264 | compare(defaults.selected, false, "Not selected by default"); |
120 | 265 | compare(defaults.selectMode, false, "Not selectable by default"); | 265 | compare(defaults.selectMode, false, "Not selectable by default"); |
121 | 266 | compare(defaults.swipePosition, 0, "swipePosition must be 0 by default"); | ||
122 | 266 | compare(testColumn.ViewItems.selectMode, false, "The parent attached property is not selectable by default"); | 267 | compare(testColumn.ViewItems.selectMode, false, "The parent attached property is not selectable by default"); |
123 | 267 | compare(testColumn.ViewItems.selectedIndices.length, 0, "No item is selected by default"); | 268 | compare(testColumn.ViewItems.selectedIndices.length, 0, "No item is selected by default"); |
124 | 268 | compare(listView.ViewItems.dragMode, false, "Drag mode is off on ListView"); | 269 | compare(listView.ViewItems.dragMode, false, "Drag mode is off on ListView"); |
125 | @@ -423,16 +424,20 @@ | |||
126 | 423 | function test_tug_actions_data() { | 424 | function test_tug_actions_data() { |
127 | 424 | var item = findChild(listView, "listItem0"); | 425 | var item = findChild(listView, "listItem0"); |
128 | 425 | return [ | 426 | return [ |
133 | 426 | {tag: "Trailing, mouse", item: item, pos: centerOf(item), dx: -units.gu(20), positiveDirection: false, mouse: true}, | 427 | {tag: "Trailing, mouse", item: item, pos: centerOf(item), dx: -units.gu(20), positiveDirection: false, mouse: true, swipePosition: false}, |
134 | 427 | {tag: "Leading, mouse", item: item, pos: centerOf(item), dx: units.gu(20), positiveDirection: true, mouse: true}, | 428 | {tag: "Leading, mouse", item: item, pos: centerOf(item), dx: units.gu(20), positiveDirection: true, mouse: true, swipePosition: false}, |
135 | 428 | {tag: "Trailing, touch", item: item, pos: centerOf(item), dx: -units.gu(20), positiveDirection: false, mouse: false}, | 429 | {tag: "Trailing, touch", item: item, pos: centerOf(item), dx: -units.gu(20), positiveDirection: false, mouse: false, swipePosition: false}, |
136 | 429 | {tag: "Leading, touch", item: item, pos: centerOf(item), dx: units.gu(20), positiveDirection: true, mouse: false}, | 430 | {tag: "Leading, touch", item: item, pos: centerOf(item), dx: units.gu(20), positiveDirection: true, mouse: false, swipePosition: false}, |
137 | 431 | {tag: "Trailing, swipePosition", item: item, pos: centerOf(item), dx: -units.gu(20), positiveDirection: false, mouse: false, swipePosition: true}, | ||
138 | 432 | {tag: "Leading, swipePosition", item: item, pos: centerOf(item), dx: units.gu(20), positiveDirection: true, mouse: false, swipePosition: true}, | ||
139 | 430 | ]; | 433 | ]; |
140 | 431 | } | 434 | } |
141 | 432 | function test_tug_actions(data) { | 435 | function test_tug_actions(data) { |
142 | 433 | listView.positionViewAtBeginning(); | 436 | listView.positionViewAtBeginning(); |
143 | 434 | if (data.mouse) { | 437 | if (data.mouse) { |
144 | 435 | swipe(data.item, data.pos.x, data.pos.y, data.dx, 0); | 438 | swipe(data.item, data.pos.x, data.pos.y, data.dx, 0); |
145 | 439 | } else if (data.swipePosition) { | ||
146 | 440 | data.item.swipePosition = data.dx; | ||
147 | 436 | } else { | 441 | } else { |
148 | 437 | tug(data.item, data.pos.x, data.pos.y, data.dx, 0); | 442 | tug(data.item, data.pos.x, data.pos.y, data.dx, 0); |
149 | 438 | } | 443 | } |
150 | @@ -458,16 +463,20 @@ | |||
151 | 458 | var item0 = findChild(listView, "listItem0"); | 463 | var item0 = findChild(listView, "listItem0"); |
152 | 459 | var item1 = findChild(listView, "listItem1"); | 464 | var item1 = findChild(listView, "listItem1"); |
153 | 460 | return [ | 465 | return [ |
158 | 461 | {tag: "Click on an other Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: true}, | 466 | {tag: "Click on an other Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: true, swipePosition: false}, |
159 | 462 | {tag: "Click on the same Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item0, mouse: true}, | 467 | {tag: "Click on the same Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item0, mouse: true, swipePosition: false}, |
160 | 463 | {tag: "Tap on an other Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: false}, | 468 | {tag: "Tap on an other Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: false, swipePosition: false}, |
161 | 464 | {tag: "Tap on the same Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item0, mouse: false}, | 469 | {tag: "Tap on the same Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item0, mouse: false, swipePosition: false}, |
162 | 470 | {tag: "Set swipePosition then click on an other Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: false, swipePosition: true}, | ||
163 | 471 | {tag: "Set swipePosition then click on the same Item", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item0, mouse: false, swipePosition: true}, | ||
164 | 465 | ]; | 472 | ]; |
165 | 466 | } | 473 | } |
166 | 467 | function test_rebound_when_pressed_outside_or_clicked(data) { | 474 | function test_rebound_when_pressed_outside_or_clicked(data) { |
167 | 468 | listView.positionViewAtBeginning(); | 475 | listView.positionViewAtBeginning(); |
168 | 469 | if (data.mouse) { | 476 | if (data.mouse) { |
169 | 470 | swipe(data.item, data.pos.x, data.pos.y, data.dx, 0); | 477 | swipe(data.item, data.pos.x, data.pos.y, data.dx, 0); |
170 | 478 | } else if (data.swipePosition) { | ||
171 | 479 | data.item.swipePosition = data.dx; | ||
172 | 471 | } else { | 480 | } else { |
173 | 472 | tug(data.item, data.pos.x, data.pos.y, data.dx, 0); | 481 | tug(data.item, data.pos.x, data.pos.y, data.dx, 0); |
174 | 473 | } | 482 | } |
175 | @@ -484,6 +493,8 @@ | |||
176 | 484 | {tag: "Leading", item: item0, pos: centerOf(item0), dx: units.gu(20), clickOn: item0.contentItem, mouse: true}, | 493 | {tag: "Leading", item: item0, pos: centerOf(item0), dx: units.gu(20), clickOn: item0.contentItem, mouse: true}, |
177 | 485 | {tag: "Trailing", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: false}, | 494 | {tag: "Trailing", item: item0, pos: centerOf(item0), dx: -units.gu(20), clickOn: item1, mouse: false}, |
178 | 486 | {tag: "Leading", item: item0, pos: centerOf(item0), dx: units.gu(20), clickOn: item0.contentItem, mouse: false}, | 495 | {tag: "Leading", item: item0, pos: centerOf(item0), dx: units.gu(20), clickOn: item0.contentItem, mouse: false}, |
179 | 496 | {tag: "Trailing, swipePosition", item: item0, pos: centerOf(item0), dx: -units.gu(10), clickOn: item1, mouse: false, swipePosition: true}, | ||
180 | 497 | {tag: "Leading, swipePosition", item: item0, pos: centerOf(item0), dx: units.gu(10), clickOn: item0.contentItem, mouse: false, swipePosition: true}, | ||
181 | 487 | ]; | 498 | ]; |
182 | 488 | } | 499 | } |
183 | 489 | function test_listview_not_interactive_while_tugged(data) { | 500 | function test_listview_not_interactive_while_tugged(data) { |
184 | @@ -492,6 +503,8 @@ | |||
185 | 492 | compare(listView.interactive, true, "ListView is not interactive"); | 503 | compare(listView.interactive, true, "ListView is not interactive"); |
186 | 493 | if (data.mouse) { | 504 | if (data.mouse) { |
187 | 494 | swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); | 505 | swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
188 | 506 | } else if (data.swipePosition) { | ||
189 | 507 | data.item.swipePosition = data.dx; | ||
190 | 495 | } else { | 508 | } else { |
191 | 496 | tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); | 509 | tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
192 | 497 | } | 510 | } |
193 | 498 | 511 | ||
194 | === modified file 'tests/unit/visual/tst_listitem_extras.13.qml' | |||
195 | --- tests/unit/visual/tst_listitem_extras.13.qml 2016-06-15 13:46:51 +0000 | |||
196 | +++ tests/unit/visual/tst_listitem_extras.13.qml 2016-10-14 12:12:03 +0000 | |||
197 | @@ -215,17 +215,25 @@ | |||
198 | 215 | 215 | ||
199 | 216 | function test_button_inactive_while_swiped_data() { | 216 | function test_button_inactive_while_swiped_data() { |
200 | 217 | return [ | 217 | return [ |
203 | 218 | {tag: "mouse", touch: false, dx: units.gu(20)}, | 218 | {tag: "mouse", touch: false, swipePosition: false, dx: units.gu(20)}, |
204 | 219 | {tag: "touch", touch: true, dx: units.gu(20)}, | 219 | {tag: "touch", touch: true, swipePosition: false, dx: units.gu(20)}, |
205 | 220 | {tag: "swipePosition", touch: false, swipePosition: true, dx: units.gu(20)}, | ||
206 | 221 | {tag: "swipePosition", touch: true, swipePosition: true, dx: units.gu(20)}, | ||
207 | 220 | ]; | 222 | ]; |
208 | 221 | } | 223 | } |
209 | 222 | function test_button_inactive_while_swiped(data) { | 224 | function test_button_inactive_while_swiped(data) { |
210 | 223 | clickSpy.target = activeItem; | 225 | clickSpy.target = activeItem; |
211 | 226 | if (data.swipePosition) { | ||
212 | 227 | testWithActiveItem.swipePosition = data.dx; | ||
213 | 228 | } else if (data.touch) { | ||
214 | 229 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
215 | 230 | } else { | ||
216 | 231 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
217 | 232 | } | ||
218 | 233 | |||
219 | 224 | if (data.touch) { | 234 | if (data.touch) { |
220 | 225 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
221 | 226 | TestExtras.touchClick(0, activeItem, centerOf(activeItem)); | 235 | TestExtras.touchClick(0, activeItem, centerOf(activeItem)); |
222 | 227 | } else { | 236 | } else { |
223 | 228 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
224 | 229 | mouseClick(activeItem, centerOf(activeItem).x, centerOf(activeItem).y); | 237 | mouseClick(activeItem, centerOf(activeItem).x, centerOf(activeItem).y); |
225 | 230 | } | 238 | } |
226 | 231 | expectFail(data.tag, "Button is inactive while swiped"); | 239 | expectFail(data.tag, "Button is inactive while swiped"); |
227 | @@ -271,16 +279,20 @@ | |||
228 | 271 | 279 | ||
229 | 272 | function test_swipe_on_empty_actions_bug1500416_data() { | 280 | function test_swipe_on_empty_actions_bug1500416_data() { |
230 | 273 | return [ | 281 | return [ |
235 | 274 | {tag: "swipe leading, touch", item: emptyActionList, dx: units.gu(5), touch: true}, | 282 | {tag: "swipe leading, touch", item: emptyActionList, dx: units.gu(5), touch: true, swipePosition: false}, |
236 | 275 | {tag: "swipe trailing, touch", item: emptyActionList, dx: -units.gu(5), touch: true}, | 283 | {tag: "swipe trailing, touch", item: emptyActionList, dx: -units.gu(5), touch: true, swipePosition: false}, |
237 | 276 | {tag: "swipe leading, mouse", item: emptyActionList, dx: units.gu(5), touch: false}, | 284 | {tag: "swipe leading, mouse", item: emptyActionList, dx: units.gu(5), touch: false, swipePosition: false}, |
238 | 277 | {tag: "swipe trailing, mouse", item: emptyActionList, dx: -units.gu(5), touch: false} | 285 | {tag: "swipe trailing, mouse", item: emptyActionList, dx: -units.gu(5), touch: false, swipePosition: false}, |
239 | 286 | {tag: "swipe leading, swipePosition", item: emptyActionList, dx: units.gu(5), touch: false, swipePosition: true}, | ||
240 | 287 | {tag: "swipe trailing, swipePosition", item: emptyActionList, dx: -units.gu(5), touch: false, swipePosition: true} | ||
241 | 278 | ]; | 288 | ]; |
242 | 279 | } | 289 | } |
243 | 280 | function test_swipe_on_empty_actions_bug1500416(data) { | 290 | function test_swipe_on_empty_actions_bug1500416(data) { |
244 | 281 | setupSpy(data.item, "contentMovementEnded"); | 291 | setupSpy(data.item, "contentMovementEnded"); |
245 | 282 | if (data.touch) { | 292 | if (data.touch) { |
246 | 283 | tugNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); | 293 | tugNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); |
247 | 294 | } else if (data.swipePosition) { | ||
248 | 295 | data.item.swipePosition = data.dx; | ||
249 | 284 | } else { | 296 | } else { |
250 | 285 | swipeNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); | 297 | swipeNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); |
251 | 286 | } | 298 | } |
252 | @@ -291,10 +303,12 @@ | |||
253 | 291 | function test_swipe_not_possible_when_swipe_disabled_data() { | 303 | function test_swipe_not_possible_when_swipe_disabled_data() { |
254 | 292 | listView.positionViewAtBeginning(); | 304 | listView.positionViewAtBeginning(); |
255 | 293 | return [ | 305 | return [ |
260 | 294 | {tag: "leading, touch", item: findChild(listView, "listItem0"), dx: units.gu(10), touch: true}, | 306 | {tag: "leading, touch", item: findChild(listView, "listItem0"), dx: units.gu(10), touch: true, swipePosition: false}, |
261 | 295 | {tag: "trailing, touch", item: findChild(listView, "listItem0"), dx: -units.gu(10), touch: true}, | 307 | {tag: "trailing, touch", item: findChild(listView, "listItem0"), dx: -units.gu(10), touch: true, swipePosition: false}, |
262 | 296 | {tag: "leading, mouse", item: findChild(listView, "listItem0"), dx: units.gu(10), touch: false}, | 308 | {tag: "leading, mouse", item: findChild(listView, "listItem0"), dx: units.gu(10), touch: false, swipePosition: false}, |
263 | 297 | {tag: "trailing, mouse", item: findChild(listView, "listItem0"), dx: -units.gu(10), touch: false}, | 309 | {tag: "trailing, mouse", item: findChild(listView, "listItem0"), dx: -units.gu(10), touch: false, swipePosition: false}, |
264 | 310 | {tag: "leading, swipePosition", item: findChild(listView, "listItem0"), dx: units.gu(10), touch: false, swipePosition: true}, | ||
265 | 311 | {tag: "trailing, swipePosition", item: findChild(listView, "listItem0"), dx: -units.gu(10), touch: false, swipePosition: true}, | ||
266 | 298 | ]; | 312 | ]; |
267 | 299 | } | 313 | } |
268 | 300 | function test_swipe_not_possible_when_swipe_disabled(data) { | 314 | function test_swipe_not_possible_when_swipe_disabled(data) { |
269 | @@ -303,6 +317,8 @@ | |||
270 | 303 | setupSpy(data.item, "contentMovementEnded"); | 317 | setupSpy(data.item, "contentMovementEnded"); |
271 | 304 | if (data.touch) { | 318 | if (data.touch) { |
272 | 305 | tugNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); | 319 | tugNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); |
273 | 320 | } else if (data.swipePosition) { | ||
274 | 321 | data.item.swipePosition = data.dx; | ||
275 | 306 | } else { | 322 | } else { |
276 | 307 | swipeNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); | 323 | swipeNoWait(data.item, centerOf(data.item).x, centerOf(data.item).y, data.dx, 0); |
277 | 308 | } | 324 | } |
FAILED: Continuous integration, rev:2144 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-armhf- stable/ 1541/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/7082/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-armhf- stable/ 1541/rebuild
https:/