diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-10-10 10:29:50 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-10-10 10:54:35 +0000 |
commit | 2430cc139437dac021b6028d8ba8799c50bd0e6c (patch) | |
tree | fc94333b1290fa81352ab09950b9302888348eaa /tests | |
parent | 1a5567b29f4e2c3ffda3626656ef521013ff69ee (diff) | |
download | qtquickcontrols-2430cc139437dac021b6028d8ba8799c50bd0e6c.tar.gz |
Update slider handle position when maximum changes
This is exactly the same as the minimum change, when the maximum is
changed, the handle position needs to be re-evaluated.
Task-number: QTBUG-63354
Change-Id: I13a67451190a3bb7915afe8e89501097c1dd3301
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 0eec7e34..34627daa 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -392,7 +392,7 @@ Item { } } - function test_minimumValueLargerThanValue() { + function test_minimumMaximumValueLargerThanValue() { var control = sliderComponent.createObject(container, { "style": namedHandleStyle, "minimumValue": 0, "maximumValue": 2, value: "minimumValue" }); verify(control); @@ -405,6 +405,19 @@ Item { compare(control.value, control.minimumValue); compare(handle.mapToItem(null, 0, 0).x, 0) + control.maximumValue = 5; + control.value = 5; + compare(control.value, 5); + + // get the slider position at max + var maxPos = handle.mapToItem(null, 0, 0).x; + + // reduce the maximum value, resulting in the value becoming 4 as well + control.maximumValue = 4; + compare(control.value, 4); + // make sure that the actual position of the handle is the same (it used to be off - see QTBUG-63354) + compare(handle.mapToItem(null, 0, 0).x, maxPos); + control.destroy(); } } |