Merge lp:~zsombi/ubuntu-ui-toolkit/fixAbstractButtonBindingLoop into lp:ubuntu-ui-toolkit/staging
- fixAbstractButtonBindingLoop
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1929 |
Merged at revision: | 1955 |
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/fixAbstractButtonBindingLoop |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
310 lines (+139/-60) 4 files modified
src/Ubuntu/Components/plugin/ucabstractbutton.cpp (+48/-11) src/Ubuntu/Components/plugin/ucabstractbutton.h (+4/-0) src/Ubuntu/Components/plugin/ucabstractbutton_p.h (+1/-0) tests/unit_x11/tst_components/tst_abstractbutton13.qml (+86/-49) |
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/fixAbstractButtonBindingLoop |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Review via email: mp+291950@code.launchpad.net |
Commit message
Fix binding loops in AbstractButton
Description of the change
The AbstractButton differentiates the touch events from mouse events. The sensingMargins only affect touch events, mouse events are restricted to the visual area.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1925
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:1925
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:1925
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:1925
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Tim Peeters (tpeeters) wrote : | # |
Good stuff. Just 2 inline comments.
Tim Peeters (tpeeters) wrote : | # |
one update inline
Tim Peeters (tpeeters) wrote : | # |
update inline.
Zsombor Egri (zsombi) wrote : | # |
See replies :)
Tim Peeters (tpeeters) wrote : | # |
see below :)
- 1926. By Zsombor Egri
-
review comments
- 1927. By Zsombor Egri
-
staging sync
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1927
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:1927
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:1927
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:1927
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:1927
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Tim Peeters (tpeeters) wrote : | # |
So now when touch is cancelled, nothing needs to be done, and pressed stays true?
- 1928. By Zsombor Egri
-
reset pressed on touch cancel, but do not emit clicked() signal
Zsombor Egri (zsombi) wrote : | # |
> So now when touch is cancelled, nothing needs to be done, and pressed stays
> true?
Oh... you were right! I fixed it!
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1928
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:1928
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:1928
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:1928
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:1928
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Tim Peeters (tpeeters) wrote : | # |
This still needs an update to ensure we get a clicked() event when pressAndHold is connected (but not triggered).
- 1929. By Zsombor Egri
-
generate mouse events out of the touch events and let MouseArea handle the rest
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1929
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:1929
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:1929
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:1929
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:1929
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Tim Peeters (tpeeters) wrote : | # |
Looks good, thanks. Approving.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1929
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:1929
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:1929
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:1929
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/Ubuntu/Components/plugin/ucabstractbutton.cpp' |
2 | --- src/Ubuntu/Components/plugin/ucabstractbutton.cpp 2016-04-20 15:00:27 +0000 |
3 | +++ src/Ubuntu/Components/plugin/ucabstractbutton.cpp 2016-04-25 06:32:56 +0000 |
4 | @@ -233,6 +233,33 @@ |
5 | } |
6 | } |
7 | |
8 | +void UCAbstractButton::touchEvent(QTouchEvent *event) |
9 | +{ |
10 | + UCActionItem::touchEvent(event); |
11 | + |
12 | + Q_D(UCAbstractButton); |
13 | + switch (event->type()) { |
14 | + case QEvent::TouchBegin: |
15 | + { |
16 | + // send an event to MouseArea to handle the event |
17 | + QMouseEvent mouse(QEvent::MouseButtonPress, QPointF(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
18 | + qApp->sendEvent(d->mouseArea, &mouse); |
19 | + event->accept(); |
20 | + break; |
21 | + } |
22 | + case QEvent::TouchCancel: |
23 | + case QEvent::TouchEnd: |
24 | + { |
25 | + QMouseEvent mouse(QEvent::MouseButtonRelease, QPointF(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
26 | + qApp->sendEvent(d->mouseArea, &mouse); |
27 | + event->accept(); |
28 | + break; |
29 | + } |
30 | + default: |
31 | + break; |
32 | + } |
33 | +} |
34 | + |
35 | void UCAbstractButtonPrivate::_q_adjustSensingArea() |
36 | { |
37 | Q_Q(UCAbstractButton); |
38 | @@ -247,24 +274,27 @@ |
39 | - (q->width() + (sensingMargins ? (sensingMargins->left() + sensingMargins->right()) : 0.0)); |
40 | qreal vDelta = minimumHeight |
41 | - (q->height() + (sensingMargins ? (sensingMargins->top() + sensingMargins->bottom()) : 0.0)); |
42 | + |
43 | // adjust the sensing area |
44 | - QQuickAnchors *mouseAreaAnchors = QQuickItemPrivate::get(mouseArea)->anchors(); |
45 | + qreal dx1, dy1, dx2, dy2; |
46 | if (hDelta >= 0) { |
47 | // the horizontal size is still smaller than the minimum |
48 | - mouseAreaAnchors->setLeftMargin(-(hDelta / 2 + (sensingMargins ? sensingMargins->left() : 0.0))); |
49 | - mouseAreaAnchors->setRightMargin(-(hDelta / 2 + (sensingMargins ? sensingMargins->right() : 0.0))); |
50 | + dx1 = -(hDelta / 2 + (sensingMargins ? sensingMargins->left() : 0.0)); |
51 | + dx2 = (hDelta / 2 + (sensingMargins ? sensingMargins->right() : 0.0)); |
52 | } else { |
53 | - mouseAreaAnchors->setLeftMargin(sensingMargins ? -sensingMargins->left() : 0.0); |
54 | - mouseAreaAnchors->setRightMargin(sensingMargins ? -sensingMargins->right() : 0.0); |
55 | + dx1 = sensingMargins ? -sensingMargins->left() : 0.0; |
56 | + dx2 = sensingMargins ? sensingMargins->right() : 0.0; |
57 | } |
58 | if (vDelta >= 0) { |
59 | // the vertical size is still smaller than the minimum |
60 | - mouseAreaAnchors->setTopMargin(-(vDelta / 2 + (sensingMargins ? sensingMargins->top() : 0.0))); |
61 | - mouseAreaAnchors->setBottomMargin(-(vDelta / 2 + (sensingMargins ? sensingMargins->bottom() : 0.0))); |
62 | + dy1 = -(vDelta / 2 + (sensingMargins ? sensingMargins->top() : 0.0)); |
63 | + dy2 = (vDelta / 2 + (sensingMargins ? sensingMargins->bottom() : 0.0)); |
64 | } else { |
65 | - mouseAreaAnchors->setTopMargin(sensingMargins ? -sensingMargins->top() : 0.0); |
66 | - mouseAreaAnchors->setBottomMargin(sensingMargins ? -sensingMargins->bottom() : 0.0); |
67 | + dy1 = sensingMargins ? -sensingMargins->top() : 0.0; |
68 | + dy2 = sensingMargins ? sensingMargins->bottom() : 0.0; |
69 | } |
70 | + sensingArea = q->boundingRect(); |
71 | + sensingArea.adjust(dx1, dy1, dx2, dy2); |
72 | } |
73 | |
74 | void UCAbstractButton::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
75 | @@ -320,10 +350,11 @@ |
76 | * \qmlproperty real AbstractButton::sensingMargins.bottom |
77 | * \qmlproperty real AbstractButton::sensingMargins.all |
78 | * The property group specifies the margins extending the visual area where the |
79 | - * touch and mouse events are sensed. Positive values mean the area will be extended |
80 | + * touch events are sensed. Positive values mean the area will be extended |
81 | * on the specified direction outside of the visual area, negative values mean |
82 | * the sensing will fall under the component's visual border. |
83 | - * All values default to 0. |
84 | + * All values default to 0. This does not affect mouse sensing area, which only |
85 | + * covers the visual area of the component. |
86 | * |
87 | * \note If the visual area and the sensing margins are not reaching the 4x4 grid |
88 | * units limit, the component will fall back to these minimum limits. |
89 | @@ -366,4 +397,10 @@ |
90 | return d->sensingMargins; |
91 | } |
92 | |
93 | +bool UCAbstractButton::contains(const QPointF &point) const |
94 | +{ |
95 | + Q_D(const UCAbstractButton); |
96 | + return d->sensingArea.contains(point); |
97 | +} |
98 | + |
99 | #include "moc_ucabstractbutton.cpp" |
100 | |
101 | === modified file 'src/Ubuntu/Components/plugin/ucabstractbutton.h' |
102 | --- src/Ubuntu/Components/plugin/ucabstractbutton.h 2016-02-10 19:35:49 +0000 |
103 | +++ src/Ubuntu/Components/plugin/ucabstractbutton.h 2016-04-25 06:32:56 +0000 |
104 | @@ -47,11 +47,15 @@ |
105 | void setAcceptEvents(bool value); |
106 | QQuickMouseArea *privateMouseArea() const; |
107 | |
108 | + // override containment check |
109 | + bool contains(const QPointF &point) const override; |
110 | + |
111 | protected: |
112 | void classBegin(); |
113 | virtual void geometryChanged(const QRectF &newGeometry, |
114 | const QRectF &oldGeometry); |
115 | void keyReleaseEvent(QKeyEvent *key); |
116 | + void touchEvent(QTouchEvent *event); |
117 | |
118 | Q_SIGNALS: |
119 | void pressedChanged(); |
120 | |
121 | === modified file 'src/Ubuntu/Components/plugin/ucabstractbutton_p.h' |
122 | --- src/Ubuntu/Components/plugin/ucabstractbutton_p.h 2016-03-01 19:36:40 +0000 |
123 | +++ src/Ubuntu/Components/plugin/ucabstractbutton_p.h 2016-04-25 06:32:56 +0000 |
124 | @@ -43,6 +43,7 @@ |
125 | void _q_mouseAreaPressAndHold(); |
126 | void _q_adjustSensingArea(); |
127 | |
128 | + QRectF sensingArea; |
129 | QQuickMouseArea *mouseArea; |
130 | UCMargins *sensingMargins = nullptr; |
131 | bool acceptEvents:1; |
132 | |
133 | === modified file 'tests/unit_x11/tst_components/tst_abstractbutton13.qml' |
134 | --- tests/unit_x11/tst_components/tst_abstractbutton13.qml 2016-03-15 13:26:55 +0000 |
135 | +++ tests/unit_x11/tst_components/tst_abstractbutton13.qml 2016-04-25 06:32:56 +0000 |
136 | @@ -24,6 +24,18 @@ |
137 | height: units.gu(71) |
138 | |
139 | Column { |
140 | + anchors.horizontalCenter: parent.horizontalCenter |
141 | + AbstractButton { |
142 | + id: bindingLoopGuard |
143 | + implicitWidth: childrenRect.width |
144 | + implicitHeight: childrenRect.height |
145 | + |
146 | + Rectangle { |
147 | + width: units.gu(2) |
148 | + height: width |
149 | + color: "green" |
150 | + } |
151 | + } |
152 | AbstractButton { |
153 | id: absButton |
154 | width: units.gu(10) |
155 | @@ -155,6 +167,7 @@ |
156 | } |
157 | |
158 | function initTestCase() { |
159 | + TestExtras.registerTouchDevice(); |
160 | compare(buttonWithSensing.sensingMargins.left, 0); |
161 | compare(buttonWithSensing.sensingMargins.right, 0); |
162 | compare(buttonWithSensing.sensingMargins.top, 0); |
163 | @@ -237,60 +250,84 @@ |
164 | compare(loader.click, true, "clicked not captured by Connection"); |
165 | } |
166 | |
167 | + // the sensing area only refers to touch gestures, not to mouse events |
168 | + // the area minimum size is 4x4 GU, meaning if a component defines a size of 3x3, the sensing area |
169 | + // will increase it with 0.5GU all around to reach 4x4 size |
170 | function test_sensing_area_data() { |
171 | return [ |
172 | // margins is [left, top, right, bottom] |
173 | - {tag: "zero size, no margins, click in visual", sizeGU: [0, 0], clickGU: [0, 0], sensingGU: [4, 4]}, |
174 | - {tag: "zero size, no margins, click in sensing", sizeGU: [0, 0], clickGU: [4, 4], sensingGU: [4, 4]}, |
175 | - {tag: "zero size, 1GU margins, click in visual", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], sensingGU: [4, 4]}, |
176 | - {tag: "zero size, 1GU margins, click in sensing", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [4, 4], sensingGU: [4, 4]}, |
177 | - {tag: "zero size, 3GU margins horizontal, click in sensing", sizeGU: [0, 0], marginsGU: [3, 0, 3, 0], clickGU: [4, 4], sensingGU: [6, 4]}, |
178 | - {tag: "zero size, 3GU margins vertical, click in sensing", sizeGU: [0, 0], marginsGU: [0, 3, 0, 3], clickGU: [4, 4], sensingGU: [4, 6]}, |
179 | - {tag: "zero size, 3GU margins around, click in sensing", sizeGU: [0, 0], marginsGU: [3, 3, 3, 3], clickGU: [4, 4], sensingGU: [6, 6]}, |
180 | - |
181 | - {tag: "3x3GU size, no margins, click in visual", sizeGU: [3, 3], clickGU: [0, 0], sensingGU: [4, 4]}, |
182 | - {tag: "3x3GU size, no margins, click in sensing", sizeGU: [3, 3], clickGU: [4, 4], sensingGU: [4, 4]}, |
183 | - {tag: "3x3GU size, 1GU margins, click in visual", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], sensingGU: [5, 5]}, |
184 | - {tag: "3x3GU size, 1GU margins, click in sensing", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [4, 4], sensingGU: [5, 5]}, |
185 | - {tag: "3x3GU size, 3GU margins horizontal, click in sensing", sizeGU: [3, 3], marginsGU: [3, 0, 3, 0], clickGU: [4, 4], sensingGU: [9, 4]}, |
186 | - {tag: "3x3GU size, 3GU margins vertical, click in sensing", sizeGU: [3, 3], marginsGU: [0, 3, 0, 3], clickGU: [4, 4], sensingGU: [4, 9]}, |
187 | - {tag: "3x3GU size, 3GU margins around, click in sensing", sizeGU: [3, 3], marginsGU: [3, 3, 3, 3], clickGU: [4, 4], sensingGU: [9, 9]}, |
188 | - |
189 | - {tag: "5x5GU size, no margins, click in visual", sizeGU: [5, 5], clickGU: [0, 0], sensingGU: [5, 5]}, |
190 | - {tag: "5x5GU size, no margins, click in sensing", sizeGU: [5, 5], clickGU: [4, 4], sensingGU: [5, 5]}, |
191 | - {tag: "5x5GU size, 1GU margins, click in visual", sizeGU: [5, 5], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], sensingGU: [7, 7]}, |
192 | - {tag: "5x5GU size, 1GU margins, click in sensing", sizeGU: [5, 5], marginsGU: [1, 1, 1, 1], clickGU: [4, 4], sensingGU: [7, 7]}, |
193 | - {tag: "5x5GU size, 3GU margins horizontal, click in sensing", sizeGU: [5, 5], marginsGU: [3, 0, 3, 0], clickGU: [4, 4], sensingGU: [11, 5]}, |
194 | - {tag: "5x5GU size, 3GU margins vertical, click in sensing", sizeGU: [5, 5], marginsGU: [0, 3, 0, 3], clickGU: [4, 4], sensingGU: [5, 11]}, |
195 | - {tag: "5x5GU size, 3GU margins around, click in sensing", sizeGU: [5, 5], marginsGU: [3, 3, 3, 3], clickGU: [4, 4], sensingGU: [11, 11]}, |
196 | - |
197 | - {tag: "zero size, no margins, click out of sensing area", sizeGU: [0, 0], clickGU: [5, 5], sensingGU: [4, 4], fail: true}, |
198 | - {tag: "2x2GU size, no margins, click out of sensing area", sizeGU: [2, 2], clickGU: [5, 5], sensingGU: [4, 4], fail: true}, |
199 | - {tag: "4x4GU size, no margins, click out of sensing area", sizeGU: [4, 4], clickGU: [5, 5], sensingGU: [4, 4], fail: true}, |
200 | - {tag: "2x2GU size, 1GU margins around, click out of sensing area", sizeGU: [2, 2], marginsGU: [1, 1, 1, 1], clickGU: [5, 5], sensingGU: [4, 4], fail: true}, |
201 | - {tag: "4x4GU size, 1GU margins around, click out of sensing area", sizeGU: [4, 4], marginsGU: [1, 1, 1, 1], clickGU: [6.1, 6.1], sensingGU: [6, 6], fail: true}, |
202 | + {tag: "zero size, no margins, tap in visual", sizeGU: [0, 0], clickGU: [0, 0], touch: true}, |
203 | + {tag: "zero size, no margins, click in visual", sizeGU: [0, 0], clickGU: [0, 0], fail: true}, |
204 | + {tag: "zero size, no margins, tap in sensing +", sizeGU: [0, 0], clickGU: [2, 2], touch: true}, |
205 | + {tag: "zero size, no margins, tap in sensing -", sizeGU: [0, 0], clickGU: [-2, -2], touch: true}, |
206 | + {tag: "zero size, no margins, click in sensing", sizeGU: [0, 0], clickGU: [2, 2], fail: true}, |
207 | + {tag: "zero size, 1GU margins, tap in visual", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], touch: true}, |
208 | + {tag: "zero size, 1GU margins, click in visual", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], fail: true}, |
209 | + {tag: "zero size, 1GU margins, tap in sensing", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [2, 2], touch: true}, |
210 | + {tag: "zero size, 1GU margins, click in sensing", sizeGU: [0, 0], marginsGU: [1, 1, 1, 1], clickGU: [2, 2], fail: true}, |
211 | + {tag: "zero size, 3GU margins horizontal, tap in sensing", sizeGU: [0, 0], marginsGU: [3, 0, 3, 0], clickGU: [3, 2], touch: true}, |
212 | + {tag: "zero size, 3GU margins horizontal, click in sensing", sizeGU: [0, 0], marginsGU: [3, 0, 3, 0], clickGU: [3, 2], fail: true}, |
213 | + {tag: "zero size, 3GU margins vertical, tap in sensing", sizeGU: [0, 0], marginsGU: [0, 3, 0, 3], clickGU: [2, 3], touch: true}, |
214 | + {tag: "zero size, 3GU margins vertical, click in sensing", sizeGU: [0, 0], marginsGU: [0, 3, 0, 3], clickGU: [2, 3], fail: true}, |
215 | + {tag: "zero size, 3GU margins around, tap in sensing", sizeGU: [0, 0], marginsGU: [3, 3, 3, 3], clickGU: [3, 3], touch: true}, |
216 | + {tag: "zero size, 3GU margins around, click in sensing", sizeGU: [0, 0], marginsGU: [3, 3, 3, 3], clickGU: [3, 3], fail: true}, |
217 | + |
218 | + {tag: "3x3GU size, no margins, tap in visual", sizeGU: [3, 3], clickGU: [0, 0], touch: true}, |
219 | + {tag: "3x3GU size, no margins, click in visual", sizeGU: [3, 3], clickGU: [0, 0]}, |
220 | + {tag: "3x3GU size, no margins, tap in sensing", sizeGU: [3, 3], clickGU: [3.5, 3.5], touch: true}, |
221 | + {tag: "3x3GU size, no margins, click in sensing", sizeGU: [3, 3], clickGU: [3.5, 3.5], fail: true}, |
222 | + {tag: "3x3GU size, 1GU margins, tap in visual", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [0, 0], touch: true}, |
223 | + {tag: "3x3GU size, 1GU margins, click in visual", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [0, 0]}, |
224 | + {tag: "3x3GU size, 1GU margins, tap in sensing", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [4, 4], touch: true}, |
225 | + {tag: "3x3GU size, 1GU margins, click in sensing", sizeGU: [3, 3], marginsGU: [1, 1, 1, 1], clickGU: [4, 4], fail: true}, |
226 | + {tag: "3x3GU size, 3GU margins horizontal, tap in sensing", sizeGU: [3, 3], marginsGU: [3, 0, 3, 0], clickGU: [6, 3.5], touch: true}, |
227 | + {tag: "3x3GU size, 3GU margins horizontal, click in sensing", sizeGU: [3, 3], marginsGU: [3, 0, 3, 0], clickGU: [6, 3.5], fail: true}, |
228 | + {tag: "3x3GU size, 3GU margins vertical, tap in sensing", sizeGU: [3, 3], marginsGU: [0, 3, 0, 3], clickGU: [3.5, 6], touch: true}, |
229 | + {tag: "3x3GU size, 3GU margins vertical, click in sensing", sizeGU: [3, 3], marginsGU: [0, 3, 0, 3], clickGU: [3.5, 6], fail: true}, |
230 | + {tag: "3x3GU size, 3GU margins around, tap in sensing", sizeGU: [3, 3], marginsGU: [3, 3, 3, 3], clickGU: [6, 6], touch: true}, |
231 | + {tag: "3x3GU size, 3GU margins around, click in sensing", sizeGU: [3, 3], marginsGU: [3, 3, 3, 3], clickGU: [6, 6], fail: true}, |
232 | + |
233 | + {tag: "5x5GU size, no margins, tap in visual", sizeGU: [5, 5], clickGU: [0, 0], touch: true}, |
234 | + {tag: "5x5GU size, no margins, tap in visual limit", sizeGU: [5, 5], clickGU: [5, 5], touch: true}, |
235 | + {tag: "5x5GU size, 1GU margins, tap in visual", sizeGU: [5, 5], marginsGU: [1, 1, 1, 1], clickGU: [5, 5], touch: true}, |
236 | + {tag: "5x5GU size, 1GU margins, tap in sensing+", sizeGU: [5, 5], marginsGU: [1, 1, 1, 1], clickGU: [6, 6], touch: true}, |
237 | + {tag: "5x5GU size, 1GU margins, tap in sensing-", sizeGU: [5, 5], marginsGU: [1, 1, 1, 1], clickGU: [-1, -1], touch: true}, |
238 | + {tag: "5x5GU size, 3GU margins horizontal, tap in sensing+", sizeGU: [5, 5], marginsGU: [3, 0, 3, 0], clickGU: [8, 5], touch: true}, |
239 | + {tag: "5x5GU size, 3GU margins horizontal, tap in sensing-", sizeGU: [5, 5], marginsGU: [3, 0, 3, 0], clickGU: [-3, 0], touch: true}, |
240 | + {tag: "5x5GU size, 3GU margins vertical, tap in sensing+", sizeGU: [5, 5], marginsGU: [0, 3, 0, 3], clickGU: [5, 8], touch: true}, |
241 | + {tag: "5x5GU size, 3GU margins vertical, tap in sensing-", sizeGU: [5, 5], marginsGU: [0, 3, 0, 3], clickGU: [0, -3], touch: true}, |
242 | + {tag: "5x5GU size, 3GU margins around, click in sensing+", sizeGU: [5, 5], marginsGU: [3, 3, 3, 3], clickGU: [8, 8], touch: true}, |
243 | + {tag: "5x5GU size, 3GU margins around, click in sensing-", sizeGU: [5, 5], marginsGU: [3, 3, 3, 3], clickGU: [-3, -3], touch: true}, |
244 | + |
245 | + {tag: "zero size, no margins, tap out of sensing area", sizeGU: [0, 0], clickGU: [5, 5], touch: true, fail: true}, |
246 | + {tag: "2x2GU size, no margins, tap out of sensing area", sizeGU: [2, 2], clickGU: [5, 5], touch: true, fail: true}, |
247 | + {tag: "4x4GU size, no margins, tap out of sensing area", sizeGU: [4, 4], clickGU: [5, 5], touch: true, fail: true}, |
248 | + {tag: "2x2GU size, 1GU margins around, tap out of sensing area", sizeGU: [2, 2], marginsGU: [1, 1, 1, 1], clickGU: [5, 5], touch: true, fail: true}, |
249 | + {tag: "4x4GU size, 1GU margins around, tap out of sensing area", sizeGU: [4, 4], marginsGU: [1, 1, 1, 1], clickGU: [5.1, 5.1], touch: true, fail: true}, |
250 | |
251 | // test margins.all |
252 | - {tag: "zero size, 5GU margins.all, click in sensing area", sizeGU: [0, 0], marginsAll: units.gu(5), clickGU: [5, 5], sensingGU: [10, 10]}, |
253 | - {tag: "2x2 size, 2GU margins.all, click in sensing area", sizeGU: [2, 2], marginsAll: units.gu(2), clickGU: [6, 6], sensingGU: [6, 6]}, |
254 | - {tag: "zero size, 5GU margins.all, click out of sensing area", sizeGU: [0, 0], marginsAll: units.gu(5), clickGU: [10.1, 10.1], sensingGU: [10, 10], fail: true}, |
255 | - {tag: "2x2 size, 2GU margins.all, click out of sensing area", sizeGU: [2, 2], marginsAll: units.gu(2), clickGU: [6.1, 6.1], sensingGU: [6, 6], fail: true}, |
256 | + {tag: "zero size, 5GU margins.all, tap in sensing area", sizeGU: [0, 0], marginsAll: units.gu(5), clickGU: [5, 5], touch: true}, |
257 | + {tag: "2x2 size, 2GU margins.all, tap in sensing area", sizeGU: [2, 2], marginsAll: units.gu(2), clickGU: [4, 4], touch: true}, |
258 | + {tag: "zero size, 5GU margins.all, tap out of sensing area", sizeGU: [0, 0], marginsAll: units.gu(5), clickGU: [5.1, 5.1], touch: true, fail: true}, |
259 | + {tag: "2x2 size, 2GU margins.all, tap out of sensing area", sizeGU: [2, 2], marginsAll: units.gu(2), clickGU: [4.1, 4.1], touch: true, fail: true}, |
260 | |
261 | // test negative margins |
262 | - {tag: "zero size, -1GU margins.all, click in sensing area", sizeGU: [0, 0], marginsAll: -units.gu(1), clickGU: [4, 4], sensingGU: [4, 4]}, |
263 | - {tag: "2x2 size, -1GU margins.all, click in sensing area", sizeGU: [2, 2], marginsAll: -units.gu(1), clickGU: [4, 4], sensingGU: [4, 4]}, |
264 | - {tag: "zero size, -1GU margins horizontal, click in sensing area", sizeGU: [0, 0], marginsGU: [-1, 0, -1, 0], clickGU: [4, 4], sensingGU: [4, 4]}, |
265 | - {tag: "zero size, -1GU margins vertical, click in sensing area", sizeGU: [0, 0], marginsGU: [0, -1, 0, -1], clickGU: [4, 4], sensingGU: [4, 4]}, |
266 | - {tag: "2x2 size, -1GU margins horizontal, click in sensing area", sizeGU: [2, 2], marginsGU: [-1, 0, -1, 0], clickGU: [4, 4], sensingGU: [4, 4]}, |
267 | - {tag: "2x2 size, -1GU margins vertical, click in sensing area", sizeGU: [2, 2], marginsGU: [0, -1, 0, -1], clickGU: [4, 4], sensingGU: [4, 4]}, |
268 | - {tag: "4x4 size, -1GU margins.all, click in sensing area", sizeGU: [4, 4], marginsAll: -units.gu(1), clickGU: [4, 4], sensingGU: [4, 4]}, |
269 | - {tag: "4x4 size, -1GU margins horizontal, click in sensing area", sizeGU: [4, 4], marginsGU: [-1, 0, -1, 0], clickGU: [4, 4], sensingGU: [4, 4]}, |
270 | - {tag: "4x4 size, -1GU margins vertical, click in sensing area", sizeGU: [4, 4], marginsGU: [0, -1, 0, -1], clickGU: [4, 4], sensingGU: [4, 4]}, |
271 | + {tag: "zero size, -1GU margins.all, tap in sensing area+", sizeGU: [0, 0], marginsAll: -units.gu(1), clickGU: [2, 2], touch: true}, |
272 | + {tag: "zero size, -1GU margins.all, tap in sensing area-", sizeGU: [0, 0], marginsAll: -units.gu(1), clickGU: [-2, -2], touch: true}, |
273 | + {tag: "2x2 size, -1GU margins.all, tap in sensing area+", sizeGU: [2, 2], marginsAll: -units.gu(1), clickGU: [3, 3], touch: true}, |
274 | + {tag: "2x2 size, -1GU margins.all, tap in sensing area-", sizeGU: [2, 2], marginsAll: -units.gu(1), clickGU: [-1, -1], touch: true}, |
275 | + {tag: "zero size, -1GU margins horizontal, tap in sensing area", sizeGU: [0, 0], marginsGU: [-1, 0, -1, 0], clickGU: [2, 2], touch: true}, |
276 | + {tag: "zero size, -1GU margins vertical, tap in sensing area", sizeGU: [0, 0], marginsGU: [0, -1, 0, -1], clickGU: [2, 2], touch: true}, |
277 | + {tag: "2x2 size, -1GU margins horizontal, tap in sensing area", sizeGU: [2, 2], marginsGU: [-1, 0, -1, 0], clickGU: [3, 3], touch: true}, |
278 | + {tag: "2x2 size, -1GU margins vertical, tap in sensing area", sizeGU: [2, 2], marginsGU: [0, -1, 0, -1], clickGU: [3, 3], touch: true}, |
279 | + {tag: "4x4 size, -1GU margins.all, tap in sensing area", sizeGU: [4, 4], marginsAll: -units.gu(1), clickGU: [4, 4], touch: true}, |
280 | + {tag: "4x4 size, -1GU margins horizontal, tap in sensing area", sizeGU: [4, 4], marginsGU: [-1, 0, -1, 0], clickGU: [4, 4], touch: true}, |
281 | + {tag: "4x4 size, -1GU margins vertical, click in sensing area", sizeGU: [4, 4], marginsGU: [0, -1, 0, -1], clickGU: [4, 4], touch: true}, |
282 | |
283 | // bigger size than minimum, decrease sensing area |
284 | - {tag: "5x5 size, -1GU margins.all, click in sensing area", sizeGU: [5, 5], marginsAll: -units.gu(1), clickGU: [4, 4], sensingGU: [4, 4]}, |
285 | - {tag: "5x5 size, -1GU margins horizontal, click in sensing area", sizeGU: [5, 5], marginsGU: [-1, 0, -1, 0], clickGU: [4, 5], sensingGU: [4, 5]}, |
286 | - {tag: "5x5 size, -1GU margins vertical, click in sensing area", sizeGU: [5, 5], marginsGU: [0, -1, 0, -1], clickGU: [5, 4], sensingGU: [5, 4]}, |
287 | + {tag: "5x5 size, -1GU margins.all, tap in sensing area", sizeGU: [5, 5], marginsAll: -units.gu(1), clickGU: [4, 4], touch: true}, |
288 | + {tag: "5x5 size, -1GU margins horizontal, tap in sensing area", sizeGU: [5, 5], marginsGU: [-1, 0, -1, 0], clickGU: [4, 5], touch: true}, |
289 | + {tag: "5x5 size, -1GU margins vertical, tap in sensing area", sizeGU: [5, 5], marginsGU: [0, -1, 0, -1], clickGU: [5, 4], touch: true}, |
290 | ]; |
291 | } |
292 | function test_sensing_area(data) { |
293 | @@ -307,14 +344,14 @@ |
294 | buttonWithSensing.sensingMargins.all = data.marginsAll; |
295 | } |
296 | |
297 | - if (data.sensingGU) { |
298 | - compare(buttonWithSensing.__mouseArea.width, units.gu(data.sensingGU[0]), "unexpected horizontal sensing size"); |
299 | - compare(buttonWithSensing.__mouseArea.height, units.gu(data.sensingGU[1]), "unexpected vertical sensing size"); |
300 | + if (data.touch) { |
301 | + TestExtras.touchClick(0, buttonWithSensing, Qt.point(units.gu(data.clickGU[0]), units.gu(data.clickGU[1]))); |
302 | + } else { |
303 | + mouseClick(buttonWithSensing.__mouseArea, units.gu(data.clickGU[0]), units.gu(data.clickGU[1])); |
304 | } |
305 | if (data.fail) { |
306 | expectFailContinue(data.tag, "no signal"); |
307 | } |
308 | - mouseClick(buttonWithSensing.__mouseArea, units.gu(data.clickGU[0]), units.gu(data.clickGU[1])); |
309 | signalSpy.wait(500); |
310 | } |
311 |
PASSED: Continuous integration, rev:1925 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 695/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/2673/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 695/rebuild
https:/