diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-07-04 14:54:47 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-07-04 18:05:29 +0000 |
commit | 26d528f6b5c61ab5003e97989693851bb6964be4 (patch) | |
tree | 67e0da1500e0dc86db739a02fa226dc9cd7eaaab /tests/auto/controls/data/tst_pageindicator.qml | |
parent | ace9d50e64b97b3a7f1fcffe9d899ff5d14f092d (diff) |
PageIndicator: fix touch support
Change-Id: I00d4f6ed466e33be3f31b2cd0bcbae6707d84cb9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_pageindicator.qml')
-rw-r--r-- | tests/auto/controls/data/tst_pageindicator.qml | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/auto/controls/data/tst_pageindicator.qml b/tests/auto/controls/data/tst_pageindicator.qml index 86c0bd8b..0ceefa35 100644 --- a/tests/auto/controls/data/tst_pageindicator.qml +++ b/tests/auto/controls/data/tst_pageindicator.qml @@ -83,20 +83,35 @@ TestCase { compare(control.currentIndex, 5) } - function test_interactive() { + function test_interactive_data() { + return [ + { tag: "mouse", touch: false }, + { tag: "touch", touch: true } + ] + } + + function test_interactive(data) { var control = createTemporaryObject(pageIndicator, testCase, {count: 5, spacing: 10, padding: 10}) verify(control) verify(!control.interactive) compare(control.currentIndex, 0) - mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton) + var touch = touchEvent(control) + + if (data.touch) + touch.press(0, control).commit().release(0, control).commit() + else + mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton) compare(control.currentIndex, 0) control.interactive = true verify(control.interactive) - mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton) + if (data.touch) + touch.press(0, control).commit().release(0, control).commit() + else + mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton) compare(control.currentIndex, 2) // test also clicking outside delegates => the nearest should be selected @@ -108,7 +123,10 @@ TestCase { compare(control.currentIndex, -1) var pos = control.mapFromItem(child, x, y) - mouseClick(control, pos.x, pos.y, Qt.LeftButton) + if (data.touch) + touch.press(0, control, pos.x, pos.y).commit().release(0, control, pos.x, pos.y).commit() + else + mouseClick(control, pos.x, pos.y, Qt.LeftButton) compare(control.currentIndex, i) } } |