aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_scrollbar.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/controls/data/tst_scrollbar.qml')
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml59
1 files changed, 45 insertions, 14 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 7dc60d97..7c83cca9 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -50,9 +50,9 @@ TestCase {
when: windowShown
name: "ScrollBar"
- SignalSpy{
- id: pressedSpy
- signalName: "pressedChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -72,16 +72,6 @@ TestCase {
}
}
- function init() {
- verify(!pressedSpy.target)
- compare(pressedSpy.count, 0)
- }
-
- function cleanup() {
- pressedSpy.target = null
- pressedSpy.clear()
- }
-
function test_attach() {
var container = flickable.createObject(testCase)
verify(container)
@@ -151,6 +141,22 @@ TestCase {
compare(horizontal.size, container.visibleArea.widthRatio)
compare(horizontal.position, container.visibleArea.xPosition)
+ var oldY = vertical.y
+ var oldHeight = vertical.height
+ vertical.parent = testCase
+ vertical.y -= 10
+ container.height += 10
+ compare(vertical.y, oldY - 10)
+ compare(vertical.height, oldHeight)
+
+ var oldX = horizontal.x
+ var oldWidth = horizontal.width
+ horizontal.parent = testCase
+ horizontal.x -= 10
+ container.width += 10
+ compare(horizontal.x, oldX - 10)
+ compare(horizontal.width, oldWidth)
+
container.destroy()
}
@@ -165,7 +171,7 @@ TestCase {
var control = scrollBar.createObject(testCase, data.properties)
verify(control)
- pressedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
mousePress(control, 0, 0, Qt.LeftButton)
@@ -211,6 +217,31 @@ TestCase {
control.destroy()
}
+ function test_increase_decrease_data() {
+ return [
+ { tag: "increase:active", increase: true, active: true },
+ { tag: "decrease:active", increase: false, active: true },
+ { tag: "increase:inactive", increase: true, active: false },
+ { tag: "decrease:inactive", increase: false, active: false }
+ ]
+ }
+
+ function test_increase_decrease(data) {
+ var control = scrollBar.createObject(testCase, {position: 0.5, active: data.active})
+ verify(control)
+
+ if (data.increase) {
+ control.increase()
+ compare(control.position, 0.6)
+ } else {
+ control.decrease()
+ compare(control.position, 0.4)
+ }
+ compare(control.active, data.active)
+
+ control.destroy()
+ }
+
function test_stepSize_data() {
return [
{ tag: "0.0", stepSize: 0.0 },