aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-07-04 15:08:51 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-04 18:05:32 +0000
commitaf74ca8e0ccf0fc59d6e918c679fcc5139aab59d (patch)
tree10f939131d484203a91f6ae3116b357afa9f215b /tests/auto/controls
parent26d528f6b5c61ab5003e97989693851bb6964be4 (diff)
PageIndicator: don't block touch when non-interactive
Unlike with mouse events there's setAcceptedMouseButtons(), currently there's no way to control whether a control receives touch events or not. As a temporary workaround until QQuickItem::setAcceptTouchEvents() has been added, we'll have to ignore touch events by hand. Task-number: QTBUG-61785 Change-Id: I8e3bdc3df1c3b28afaf8f80965569135e6a53120 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/tst_pageindicator.qml36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml
index 0ceefa35..70813cb8 100644
--- a/tests/auto/controls/data/tst_pageindicator.qml
+++ b/tests/auto/controls/data/tst_pageindicator.qml
@@ -65,6 +65,11 @@ TestCase {
PageIndicator { }
}
+ Component {
+ id: mouseArea
+ MouseArea { }
+ }
+
function test_count() {
var control = createTemporaryObject(pageIndicator, testCase)
verify(control)
@@ -132,4 +137,35 @@ TestCase {
}
}
}
+
+ function test_mouseArea_data() {
+ return [
+ { tag: "interactive", interactive: true },
+ { tag: "non-interactive", interactive: false }
+ ]
+ }
+
+ // QTBUG-61785
+ function test_mouseArea(data) {
+ var ma = createTemporaryObject(mouseArea, testCase, {width: testCase.width, height: testCase.height})
+ verify(ma)
+
+ var control = pageIndicator.createObject(ma, {count: 5, interactive: data.interactive, width: testCase.width, height: testCase.height})
+ verify(control)
+
+ compare(control.interactive, data.interactive)
+
+ mousePress(control)
+ compare(ma.pressed, !data.interactive)
+
+ mouseRelease(control)
+ verify(!ma.pressed)
+
+ var touch = touchEvent(control)
+ touch.press(0, control).commit()
+ compare(ma.pressed, !data.interactive)
+
+ touch.release(0, control).commit()
+ verify(!ma.pressed)
+ }
}