diff options
author | David Edmundson <davidedmundson@kde.org> | 2014-07-04 00:43:30 +0200 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2014-07-22 22:33:44 +0200 |
commit | 63c9d9f9b3a7fea5ed4c125bcbfa794bf16d24be (patch) | |
tree | 00344cde985346b3d9b7991c6afaa4a904436e23 /tests | |
parent | ffdfaf029208a33ad83c9d0545b9b67bd10df441 (diff) | |
download | qtquickcontrols-63c9d9f9b3a7fea5ed4c125bcbfa794bf16d24be.tar.gz |
Add scollBarPolicy properties to scrollview
This adds horizontal and vertical scrollbar policies allowing one to
pernamently show or hide the scrollbars like in QAbstractScrollArea.
Change-Id: I4989dbf2225ab34741b5a2811d7c6ff52880e0c3
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_scrollview.qml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml index 98248ed9..46ed0222 100644 --- a/tests/auto/controls/data/tst_scrollview.qml +++ b/tests/auto/controls/data/tst_scrollview.qml @@ -90,6 +90,42 @@ TestCase { scrollView.destroy() } + + function test_scrollbars() { + var component = scrollViewComponent + var scrollView = component.createObject(testCase); + scrollView.contentItem = bigItem + scrollView.parent = container + + bigItem.height = 100 + bigItem.width = 100 + + verify(!scrollView.__horizontalScrollBar.visible, "Scrollbar showing when contents already fit") + verify(!scrollView.__verticalScrollBar.visible, "Scrollbar showing when contents already fit") + + bigItem.height = 1000 + bigItem.width = 1000 + + verify(scrollView.__horizontalScrollBar.visible, "Scrollbar not showing when contents are too big") + verify(scrollView.__verticalScrollBar.visible, "Scrollbar not showing when contents are too big") + + //always off + bigItem.height = 1000 + scrollView.verticalScrollBarPolicy = Qt.ScrollBarAlwaysOff + verify(!scrollView.__verticalScrollBar.visible, "Scrollbar showing when disabled") + bigItem.height = 100 + verify(!scrollView.__verticalScrollBar.visible, "Scrollbar showing when disabled") + + //always on + scrollView.verticalScrollBarPolicy = Qt.ScrollBarAlwaysOn + bigItem.height = 1000 + verify(scrollView.__verticalScrollBar.visible, "Scrollbar not showing when forced on") + bigItem.height = 100 + verify(scrollView.__verticalScrollBar.visible, "Scrollbar not showing when forced on") + + scrollView.destroy() + } + function test_clickToCenter() { var test_control = 'import QtQuick 2.2; \ |