aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-20 08:14:57 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-21 16:20:11 +0000
commit5e162c68fade8e5d4175deb92496376bd7be43d7 (patch)
tree4440b7b212abc87a6ddb2ad7ce375c92c285d54b /tests
parent737bdea1e3dc41b5b30bb26c36224e31966ebd54 (diff)
ScrollBar: add increase(), decrease() and stepSize
Change-Id: I052b650fee7ae94cc826446d285d653a41bd1e75 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 55f31e12..9fa6496e 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -210,4 +210,42 @@ TestCase {
control.destroy()
}
+
+ function test_stepSize_data() {
+ return [
+ { tag: "0.0", stepSize: 0.0 },
+ { tag: "0.1", stepSize: 0.1 },
+ { tag: "0.5", stepSize: 0.5 }
+ ]
+ }
+
+ function test_stepSize(data) {
+ var control = scrollBar.createObject(testCase, {stepSize: data.stepSize})
+ verify(control)
+
+ compare(control.stepSize, data.stepSize)
+ compare(control.position, 0.0)
+
+ var count = 10
+ if (data.stepSize !== 0.0)
+ count = 1.0 / data.stepSize
+
+ // increase until 1.0
+ for (var i = 1; i <= count; ++i) {
+ control.increase()
+ compare(control.position, i / count)
+ }
+ control.increase()
+ compare(control.position, 1.0)
+
+ // decrease until 0.0
+ for (var d = count - 1; d >= 0; --d) {
+ control.decrease()
+ compare(control.position, d / count)
+ }
+ control.decrease()
+ compare(control.position, 0.0)
+
+ control.destroy()
+ }
}