diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-12 21:48:33 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-13 11:18:08 +0000 |
commit | 221c3ce846e5a6167aa0b2d356c23d5b9c7e32cb (patch) | |
tree | 87a19c3f7a6417699183523b80ee7d227f947f29 /tests | |
parent | 3a1a7492499ce637247fa0733d83df93d4c02b56 (diff) |
Slider: expose valueAt(pos) for getting continuous value updates
[ChangeLog][Slider] Added valueAt() method for getting continuous
value updates.
Task-number: QTBUG-53847
Change-Id: I0aa813c7105faa64b714ab0a0630f79d97a58854
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 142906c6..c7b1bd91 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -40,7 +40,7 @@ import QtQuick 2.2 import QtTest 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TestCase { id: testCase @@ -518,4 +518,24 @@ TestCase { control.destroy() } + + function test_valueAt_data() { + return [ + { tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] }, + { tag: "0..100", from: 0, to: 100, values: [0, 20, 50, 100] }, + { tag: "100..-100", from: 100, to: -100, values: [100, 60, 0, -100] } + ] + } + + function test_valueAt(data) { + var control = slider.createObject(testCase, {from: data.from, to: data.to}) + verify(control) + + compare(control.valueAt(0.0), data.values[0]) + compare(control.valueAt(0.2), data.values[1]) + compare(control.valueAt(0.5), data.values[2]) + compare(control.valueAt(1.0), data.values[3]) + + control.destroy() + } } |