aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_scrollindicator.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-06 23:27:32 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-06 23:31:16 +0200
commit9a9a9bd1144663e2cb74efdd3d3f6d76c72313f9 (patch)
tree2811ccf99d641b040587716f17be8c59a30e11fe /tests/auto/controls/data/tst_scrollindicator.qml
parent320647bce7d968b5798dfc6946df555a548e3f8f (diff)
parent86180aed5008779b1b94731d9b4c6b1fdac8f3d3 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Diffstat (limited to 'tests/auto/controls/data/tst_scrollindicator.qml')
-rw-r--r--tests/auto/controls/data/tst_scrollindicator.qml34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml
index 00730bf4..551247f6 100644
--- a/tests/auto/controls/data/tst_scrollindicator.qml
+++ b/tests/auto/controls/data/tst_scrollindicator.qml
@@ -157,4 +157,38 @@ TestCase {
ignoreWarning(Qt.resolvedUrl("tst_scrollindicator.qml") + ":45:1: QML TestCase: ScrollIndicator must be attached to a Flickable")
testCase.ScrollIndicator.vertical = null
}
+
+ function test_overshoot() {
+ var container = flickable.createObject(testCase)
+ verify(container)
+ waitForRendering(container)
+
+ var vertical = scrollIndicator.createObject(container, {size: 0.5})
+ container.ScrollIndicator.vertical = vertical
+
+ var horizontal = scrollIndicator.createObject(container, {size: 0.5})
+ container.ScrollIndicator.horizontal = horizontal
+
+ // negative vertical overshoot (pos < 0)
+ vertical.position = -0.1
+ compare(vertical.contentItem.y, vertical.topPadding)
+ compare(vertical.contentItem.height, 0.4 * vertical.availableHeight)
+
+ // positive vertical overshoot (pos + size > 1)
+ vertical.position = 0.8
+ compare(vertical.contentItem.y, vertical.topPadding + 0.8 * vertical.availableHeight)
+ compare(vertical.contentItem.height, 0.2 * vertical.availableHeight)
+
+ // negative horizontal overshoot (pos < 0)
+ horizontal.position = -0.1
+ compare(horizontal.contentItem.x, horizontal.leftPadding)
+ compare(horizontal.contentItem.width, 0.4 * horizontal.availableWidth)
+
+ // positive horizontal overshoot (pos + size > 1)
+ horizontal.position = 0.8
+ compare(horizontal.contentItem.x, horizontal.leftPadding + 0.8 * horizontal.availableWidth)
+ compare(horizontal.contentItem.width, 0.2 * horizontal.availableWidth)
+
+ container.destroy()
+ }
}