diff options
Diffstat (limited to 'tests/auto/controls/data/tst_scrollbar.qml')
-rw-r--r-- | tests/auto/controls/data/tst_scrollbar.qml | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml index 7c83cca9..54ecf15f 100644 --- a/tests/auto/controls/data/tst_scrollbar.qml +++ b/tests/auto/controls/data/tst_scrollbar.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 @@ -97,6 +97,13 @@ TestCase { compare(vertical.y, 0) verify(vertical.width > 0) compare(vertical.height, container.height) + // vertical scroll bar follows flickable's width + container.width += 10 + compare(vertical.x, container.width - vertical.width) + // ...unless explicitly positioned + vertical.x = 123 + container.width += 10 + compare(vertical.x, 123) var horizontal = scrollBar.createObject() verify(!horizontal.parent) @@ -118,6 +125,13 @@ TestCase { compare(horizontal.y, container.height - horizontal.height) compare(horizontal.width, container.width) verify(horizontal.height > 0) + // horizontal scroll bar follows flickable's height + container.height += 10 + compare(horizontal.y, container.height - horizontal.height) + // ...unless explicitly positioned + horizontal.y = 123 + container.height += 10 + compare(horizontal.y, 123) var velocity = container.maximumFlickVelocity @@ -315,4 +329,28 @@ TestCase { container.destroy() } + + function test_hover_data() { + return [ + { tag: "enabled", hoverEnabled: true }, + { tag: "disabled", hoverEnabled: false }, + ] + } + + function test_hover(data) { + var control = scrollBar.createObject(testCase, {hoverEnabled: data.hoverEnabled}) + verify(control) + + compare(control.hovered, false) + + mouseMove(control) + compare(control.hovered, data.hoverEnabled) + compare(control.active, data.hoverEnabled) + + mouseMove(control, -1, -1) + compare(control.hovered, false) + compare(control.active, false) + + control.destroy() + } } |