aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_slider.qml
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:09:07 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:09:07 +0300
commit1ce461bd1dc713cd2f79fc16c5454d587b45eefa (patch)
tree88e4849e71abfdd9bc2aa1d439ecd01afb1ca0c7 /tests/auto/controls/data/tst_slider.qml
parentc433697a686e7a24dc4bfd58f2a46c05ae7b7716 (diff)
parent56acab014d490951f14e6719b7bd535146646fc7 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Diffstat (limited to 'tests/auto/controls/data/tst_slider.qml')
-rw-r--r--tests/auto/controls/data/tst_slider.qml35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index e1e1ed97..bf65e486 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -923,4 +923,39 @@ TestCase {
touch.release(0, control, x0 + data.dx2, y0 + data.dy2).commit()
}
+
+ Component {
+ id: listViewWithPressDelayAndSliders
+ ListView {
+ width: 300
+ height: 500
+ model: 3
+ pressDelay: 150
+ delegate: Slider {
+ width: 300
+ height: 150
+ }
+ }
+ }
+
+ function test_listViewWithPressDelay() {
+ var listView = createTemporaryObject(listViewWithPressDelayAndSliders, testCase, { width: parent.width, height: parent.height })
+ verify(listView)
+ var control = listView.itemAtIndex(0)
+ verify(control)
+ var movedSpy = signalSpy.createObject(control, {target: control, signalName: "moved"})
+ verify(movedSpy.valid)
+
+ var touch = touchEvent(control)
+ var x0 = control.handle.x + control.handle.width * 0.5
+ var y0 = control.handle.y + control.handle.height * 0.5
+ touch.press(0, control, x0, y0).commit()
+ tryCompare(control, "pressed", true)
+ fuzzyCompare(control.value, 0, 0.01)
+
+ touch.move(0, control, x0 + 100, y0).commit()
+ tryVerify(function() { return (control.value > 0.3); }) // around 0.35, depending on style
+ tryVerify(function() { return (movedSpy.count > 0); }) // ideally == 1, but in Material and Fusion it's 2
+ touch.release(0)
+ }
}