aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_rangeslider.qml
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:43 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:43 +0200
commit3a657dc092bea4d21f281368b0caad01e1aa6e32 (patch)
tree157fe82379e7d544ce92d84e8ce9fe645bc9c036 /tests/auto/controls/data/tst_rangeslider.qml
parent5b169fcfcb123c5a129ba63133dd27c56675a479 (diff)
parent29dfaa92b9d56f5555b511756f5b8ee62aabc0bf (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Diffstat (limited to 'tests/auto/controls/data/tst_rangeslider.qml')
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml
index d645ec70..42f5bad5 100644
--- a/tests/auto/controls/data/tst_rangeslider.qml
+++ b/tests/auto/controls/data/tst_rangeslider.qml
@@ -159,6 +159,43 @@ TestCase {
compare(control.first.position, 0.5)
}
+ function test_setToFromUpdatesHandles() {
+ var control = createTemporaryObject(sliderComponent, testCase, { from: 0, to: 100, "first.value": 50, "second.value": 75 })
+ verify(control)
+
+ let firstPos = control.first.position
+ let secondPos = control.second.position
+
+ var firstPosChangesSpy = signalSpy.createObject(control, {target: control.first, signalName: "positionChanged"})
+ verify(firstPosChangesSpy.valid)
+
+ var secondPosChangesSpy = signalSpy.createObject(control, {target: control.second, signalName: "positionChanged"})
+ verify(secondPosChangesSpy.valid)
+
+ // Increasing the 'to' value, so the positions of the handles should be
+ // moved to the left (become smaller)
+ control.to = 200;
+ compare(firstPosChangesSpy.count, 1)
+ compare(secondPosChangesSpy.count, 1)
+ verify(control.first.position < firstPos)
+ verify(control.second.position < secondPos)
+
+ // resetting the values
+ control.to = 100
+ firstPosChangesSpy.clear()
+ secondPosChangesSpy.clear()
+ firstPos = control.first.position
+ secondPos = control.second.position
+
+ // Decreasing the 'from' value, so the positions of the handles should
+ // be moved to the right (become larger)
+ control.from = -100
+ compare(firstPosChangesSpy.count, 1)
+ compare(secondPosChangesSpy.count, 1)
+ verify(control.first.position > firstPos)
+ verify(control.second.position > secondPos)
+ }
+
function test_setValues() {
var control = createTemporaryObject(sliderComponent, testCase)
verify(control)