summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_scrollview.qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-30 07:10:33 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-30 07:10:37 +0200
commite516c88c485d17e25a55b63d579fe90f9a529afa (patch)
tree3a1fd2e10e8e537821e3bf64b5e0c2a78e81e6ac /tests/auto/controls/data/tst_scrollview.qml
parentdf14928f12fc04857448a3ab883ffccf199e7c51 (diff)
parentabe319c9cb811832bb4c9c95290564dfa7b3603a (diff)
downloadqtquickcontrols-e516c88c485d17e25a55b63d579fe90f9a529afa.tar.gz
Merge remote-tracking branch 'origin/5.7' into 5.8v5.8.0-alpha1
Change-Id: I4f85412071d34b44f76870753e171e0beae2e7b9
Diffstat (limited to 'tests/auto/controls/data/tst_scrollview.qml')
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index a9148db4..07d6525e 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -51,6 +51,7 @@
import QtQuick 2.2
import QtTest 1.0
import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.1
import QtQuickControlsTests 1.0
Item {
@@ -100,6 +101,68 @@ TestCase {
scrollView.destroy()
}
+ Component {
+ id: dragFetchAppendComponent
+
+ ScrollView {
+ width: 400; height: 400
+ frameVisible: false
+ style: ScrollViewStyle {
+ transientScrollBars: false
+ handle: Rectangle {
+ implicitWidth: 16; implicitHeight: 16
+ color: "red"
+ }
+ scrollBarBackground: Item {width: 16 ; height: 16}
+ incrementControl: Rectangle {
+ width: 16; height: 16
+ color: "blue"
+ }
+ decrementControl: Rectangle {
+ width: 16; height: 16
+ color: "blue"
+ }
+ }
+ ListView {
+ id: view
+
+ verticalLayoutDirection: ListView.BottomToTop
+ model: TestFetchAppendModel { }
+ delegate: Text {
+ width: view.width
+ height: 60
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ text: "Item %1".arg(model.index)
+ }
+ }
+ }
+ }
+
+ function test_dragFetchAppend() { // QTBUG-50795
+ var scrollView = dragFetchAppendComponent.createObject(container)
+ verify(scrollView !== null, "view created is null")
+ waitForRendering(scrollView)
+ verify(scrollView.flickableItem.contentHeight === 60 * 20)
+
+ // After scrolling to the end, view should ask the model to fetch more
+ // data, content height should increase and scrollbar handle should move
+ // to the center.
+ mouseDrag(scrollView, scrollView.width - 2, scrollView.height - 8 - 16, 0, -scrollView.height + 8 + 16)
+ waitForRendering(scrollView)
+
+ // Move it again to fetch more data from the model.
+ mouseDrag(scrollView, scrollView.width - 2, scrollView.height / 2, 0, -scrollView.height / 2 + 8 + 16)
+ waitForRendering(scrollView)
+
+ mouseRelease(scrollView, scrollView.width - 2, 8 + 16)
+ waitForRendering(scrollView)
+
+ verify(Math.round(scrollView.flickableItem.contentHeight) > 60 * 20)
+ verify(Math.round(scrollView.flickableItem.contentY) < -(60 * 20))
+
+ scrollView.destroy()
+ }
function test_scrollbars() {
var component = scrollViewComponent