From 8d093a47f52ffcebc4e61f9918985e62424658c0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 30 Aug 2016 11:47:49 +0200 Subject: ScrollIndicator: respect the paddings when overshooting Task-number: QTBUG-55620 Change-Id: I4c06a9e7fefbdbaff7f14a972ed47242c51ca8c6 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_scrollindicator.qml | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/auto/controls/data/tst_scrollindicator.qml') diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml index 39b40852..90d9287a 100644 --- a/tests/auto/controls/data/tst_scrollindicator.qml +++ b/tests/auto/controls/data/tst_scrollindicator.qml @@ -143,4 +143,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() + } } -- cgit v1.2.3