aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview/data')
-rw-r--r--tests/auto/quick/qquicklistview/data/addoncompleted.qml90
-rw-r--r--tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml28
-rw-r--r--tests/auto/quick/qquicklistview/data/attachedProperties.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/flickBothDirections.qml15
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist-flicker.qml11
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist.qml11
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-itematindex.qml15
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-sections-package.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/listviewtest-package.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml19
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug34576.qml102
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug61537_modelChangesAsync.qml125
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug63974.qml34
-rw-r--r--tests/auto/quick/qquicklistview/data/releaseItems.qml12
-rw-r--r--tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/rightToLeft.qml9
-rw-r--r--tests/auto/quick/qquicklistview/data/roundingErrors.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/sectionSnapping.qml49
-rw-r--r--tests/auto/quick/qquicklistview/data/setpositiononlayout.qml87
-rw-r--r--tests/auto/quick/qquicklistview/data/sizeTransitions.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml18
-rw-r--r--tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml18
-rw-r--r--tests/auto/quick/qquicklistview/data/stickyPositioning-both.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/stickyPositioning-footer.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/stickyPositioning-header.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml31
-rw-r--r--tests/auto/quick/qquicklistview/data/unrequestedItems.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/usechooserwithoutdefault.qml63
29 files changed, 820 insertions, 41 deletions
diff --git a/tests/auto/quick/qquicklistview/data/addoncompleted.qml b/tests/auto/quick/qquicklistview/data/addoncompleted.qml
new file mode 100644
index 0000000000..57265cb2c0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/addoncompleted.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+
+Rectangle {
+ width: 640
+ height: 480
+ color: "green"
+
+ ListModel {
+ id: listModel
+ ListElement { name: "a" }
+ ListElement { name: "b" }
+ ListElement { name: "c" }
+ ListElement { name: "d" }
+ ListElement { name: "e" }
+ ListElement { name: "f" }
+ ListElement { name: "g" }
+ ListElement { name: "h" }
+ ListElement { name: "i" }
+ ListElement { name: "j" }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: listModel
+ objectName: "view"
+
+ delegate: Rectangle {
+ height: 15
+ width: 15
+ color: "blue"
+ objectName: name
+ Component.onCompleted: {
+ if (name.length === 1 && listModel.get(index + 1).name.length === 1) {
+ for (var i = 0; i < 10; ++i)
+ listModel.insert(index + 1, {name: name + i});
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml
new file mode 100644
index 0000000000..af35c29143
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.6
+
+ListView {
+ width: 320; height: 240
+ focus: true
+ delegate: Text {
+ height: 40; width: parent.width
+ text: model.text
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ }
+ highlight: Rectangle { color: "red" }
+ model: ListModel {
+ ListElement { text: "0" }
+ ListElement { text: "1" }
+ ListElement { text: "2" }
+ ListElement { text: "3" }
+ ListElement { text: "4" }
+ ListElement { text: "5" }
+ ListElement { text: "6" }
+ ListElement { text: "7" }
+ ListElement { text: "8" }
+ ListElement { text: "9" }
+ }
+
+ readonly property Item topItem: itemAt(0, contentY)
+ onTopItemChanged: model.append({ "text": "new" })
+}
diff --git a/tests/auto/quick/qquicklistview/data/attachedProperties.qml b/tests/auto/quick/qquicklistview/data/attachedProperties.qml
index ffba4196f6..09714b2c6e 100644
--- a/tests/auto/quick/qquicklistview/data/attachedProperties.qml
+++ b/tests/auto/quick/qquicklistview/data/attachedProperties.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/flickBothDirections.qml b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
index 5d80ce4110..b491981edb 100644
--- a/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
+++ b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -53,6 +63,7 @@ Rectangle {
contentWidth: initialContentWidth
contentHeight: initialContentHeight
flickableDirection: initialFlickableDirection
+ pixelAligned: true
delegate: Rectangle {
width: list.orientation == ListView.Vertical ? 120 : 10
height: list.orientation == ListView.Vertical ? 20 : 110
diff --git a/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
index c0cc807bc0..89daadaaa5 100644
--- a/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
+++ b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
@@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
-// a VisualItemModel
+// an ObjectModel
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height / 3
width: view.width; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height / 3
width: view.width; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height / 3
width: view.width; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/itemlist.qml b/tests/auto/quick/qquicklistview/data/itemlist.qml
index 5c7ecdd5e8..00910ae60c 100644
--- a/tests/auto/quick/qquicklistview/data/itemlist.qml
+++ b/tests/auto/quick/qquicklistview/data/itemlist.qml
@@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
-// a VisualItemModel
+// an ObjectModel
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/listview-itematindex.qml b/tests/auto/quick/qquicklistview/data/listview-itematindex.qml
new file mode 100644
index 0000000000..fba8b11933
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-itematindex.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ focus: true
+ model: 3
+
+ delegate: Text {
+ width: parent.width
+ height: 10
+ property int idx: index
+ text: index
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-sections-package.qml b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
index 8bad73b5f6..4297ab1c69 100644
--- a/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
+++ b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
width: 240
@@ -54,7 +55,7 @@ Rectangle {
}
}
},
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: testModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquicklistview/data/listviewtest-package.qml b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
index 452fe29b49..c26bbece03 100644
--- a/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
+++ b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
id: root
@@ -120,7 +121,7 @@ Rectangle {
id: headerFooter
Rectangle { height: 30; width: 240; color: "blue" }
},
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: testModel
diff --git a/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml b/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
index 086f31fd70..e0acaf49e4 100644
--- a/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
+++ b/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml b/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml
new file mode 100644
index 0000000000..bd913b2ce1
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.9
+
+ListView {
+ id: view
+ width: 200; height: 400
+
+ property real minOvershoot
+ onVerticalOvershootChanged: if (verticalOvershoot < minOvershoot) minOvershoot = verticalOvershoot
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: 0
+
+ model: 10
+ delegate: Rectangle {
+ width: 200; height: 50
+ color: index % 2 ? "red" : "green"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/qtbug34576.qml b/tests/auto/quick/qquicklistview/data/qtbug34576.qml
new file mode 100644
index 0000000000..f407d8ebe3
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug34576.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.7
+
+Rectangle {
+ id: root
+ width: 320
+ height: 240
+ color: "black"
+
+ property int current: list.currentIndex
+ property int horizontalVelocityZeroCount: 0
+
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+
+ focus: true
+
+ orientation: ListView.Horizontal
+
+ snapMode: ListView.SnapToItem
+ flickableDirection: Flickable.HorizontalFlick
+
+ model: 10
+ delegate: Item {
+ width: root.width / 3
+ height: root.height
+ Rectangle {
+ anchors.centerIn: parent
+ width: 50
+ height: 50
+ color: list.currentIndex === index ? "red" : "white"
+ }
+ }
+
+ onHorizontalVelocityChanged: {
+ if (list.horizontalVelocity === 0.0)
+ root.horizontalVelocityZeroCount++
+ }
+
+ }
+
+ Rectangle {
+ color: "red"
+ width: 50
+ height: 50
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ list.currentIndex--;
+ }
+ }
+ }
+
+ Rectangle {
+ color: "red"
+ width: 50
+ height: 50
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ list.currentIndex++;
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/qtbug61537_modelChangesAsync.qml b/tests/auto/quick/qquicklistview/data/qtbug61537_modelChangesAsync.qml
new file mode 100644
index 0000000000..0dc9e6fdb5
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug61537_modelChangesAsync.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ visible: true
+ width: 640
+ height: 480
+
+ property ListView listView
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ sourceComponent: comp
+
+ onStatusChanged: {
+ if (status == Loader.Ready) {
+ // Assign the listview to the root prop late, so
+ // that the c++ part doesn't start before everything is ready.
+ listView = item.listView
+ }
+ }
+ }
+
+ Component {
+ id: comp
+ Item {
+ property alias listView: listView
+
+ ListView {
+ id: listView
+
+ model: ListModel {
+ id: listModel
+ ListElement { title: "one" }
+ ListElement { title: "two" }
+ }
+
+ anchors.fill: parent
+ orientation: ListView.Horizontal
+
+ delegate: Item {
+ id: delegateRoot
+ objectName: "delegate"
+
+ width: 200
+ height: 200
+
+ Component.onCompleted: {
+ if (index === listModel.count - 1) {
+ // Add a new item while the outer Loader is still incubating async. If the new model item
+ // incubates using e.g QQmlIncubator::AsynchronousIfNested, it will also be loaded async, which
+ // is not currently supported (the item will not be added to the listview, or end up the wrong
+ // position, depending on its index and the current state of the refill/layout logic in
+ // QQuickListView).
+ // We add the new item here at the last delegates Component.onCompleted to hit the point in time
+ // when the listview is not expecting any more async items. In that case, the item will only be
+ // added to the list of visible items if incubated synchronously, which gives us something we
+ // can test for in the auto-test.
+ listModel.insert(0, {title: "zero"});
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ border.width: 1
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/qtbug63974.qml b/tests/auto/quick/qquicklistview/data/qtbug63974.qml
new file mode 100644
index 0000000000..1e0afa54f8
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug63974.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.6
+
+ListView {
+ id: table
+ height: 200
+ width: 100
+
+ headerPositioning: ListView.OverlayHeader
+ header: Rectangle {
+ width: table.width
+ height: 20
+ color: "red"
+ z: 100
+ }
+
+ footerPositioning: ListView.OverlayFooter
+ footer: Rectangle {
+ width: table.width
+ height: 20
+ color: "blue"
+ z: 200
+ }
+
+ model: 30
+ delegate: Rectangle {
+ height: 20
+ width: table.width
+ color: "lightgray"
+ Text {
+ text: "Item " + index
+ anchors.centerIn: parent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/releaseItems.qml b/tests/auto/quick/qquicklistview/data/releaseItems.qml
new file mode 100644
index 0000000000..de774e5e08
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/releaseItems.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ model: 100
+ delegate: Rectangle {
+ height: 40; width: 400
+ color: index % 2 ? "lightsteelblue" : "lightgray"
+ }
+ contentHeight: contentItem.children.length * 40
+}
diff --git a/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
index d79ca100f4..fa16a8529e 100644
--- a/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
+++ b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
id: root
@@ -9,7 +10,7 @@ ListView {
layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
verticalLayoutDirection: (testBottomToTop == true) ? ListView.BottomToTop : ListView.TopToBottom
- model: VisualItemModel {
+ model: ObjectModel {
Rectangle {
objectName: "red"
width: 200; height: 200; color: "red"
diff --git a/tests/auto/quick/qquicklistview/data/rightToLeft.qml b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
index 6d77de26f4..dec7e0abc1 100644
--- a/tests/auto/quick/qquicklistview/data/rightToLeft.qml
+++ b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
@@ -2,29 +2,30 @@
// changes in right-to-left layout direction
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 640
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height; width: 100; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height; width: 200; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height; width: 240; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/roundingErrors.qml b/tests/auto/quick/qquicklistview/data/roundingErrors.qml
index bf87415551..4545fcd617 100644
--- a/tests/auto/quick/qquicklistview/data/roundingErrors.qml
+++ b/tests/auto/quick/qquicklistview/data/roundingErrors.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/sectionSnapping.qml b/tests/auto/quick/qquicklistview/data/sectionSnapping.qml
new file mode 100644
index 0000000000..2583cc0377
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/sectionSnapping.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: ListView.StrictlyEnforceRange
+
+ model: ListModel {
+ ListElement { section: "1" }
+ ListElement { section: "1" }
+ ListElement { section: "1" }
+ ListElement { section: "2" }
+ ListElement { section: "2" }
+ ListElement { section: "2" }
+ }
+
+ delegate: Rectangle {
+ width: parent.width
+ height: 50
+ color: index % 2 ? "lightsteelblue" : "steelblue"
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ text: model.index
+ }
+ }
+
+ section.property: "section"
+ section.delegate: Rectangle {
+ width: parent.width
+ height: 50
+ color: "green"
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ text: "section"
+ }
+ }
+
+ highlight: Rectangle {
+ y: 100
+ z: 100
+ width: parent.width
+ height: 50
+ color: "#80FF0000"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/setpositiononlayout.qml b/tests/auto/quick/qquicklistview/data/setpositiononlayout.qml
new file mode 100644
index 0000000000..6e12eeafca
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/setpositiononlayout.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 720
+
+ ListView {
+ anchors.fill: parent
+ focus: true
+ highlightMoveDuration: 200
+ model: 50
+ spacing: 10
+ delegate: FocusScope {
+ implicitHeight: col.height
+ Column {
+ id: col
+ Text {
+ text: "YYYY"
+ }
+ ListView {
+ id: list
+ model: 1
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 250
+ orientation: ListView.Horizontal
+ delegate: Rectangle {
+ id: self
+ height: 250
+ width: 150
+ color: "blue"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/sizeTransitions.qml b/tests/auto/quick/qquicklistview/data/sizeTransitions.qml
index eae96c468f..44e4dada60 100644
--- a/tests/auto/quick/qquicklistview/data/sizeTransitions.qml
+++ b/tests/auto/quick/qquicklistview/data/sizeTransitions.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml b/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml
new file mode 100644
index 0000000000..f5b7b35d0c
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ focus: true
+
+ model: 10
+ delegate: Rectangle {
+ width: parent.width
+ height: 50
+ color: index % 2 ? "blue" : "green"
+ }
+
+ snapMode: ListView.SnapOneItem
+ Keys.onUpPressed: flick(0,500)
+ Keys.onDownPressed: flick(0,-500)
+}
diff --git a/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml
new file mode 100644
index 0000000000..50b5abb206
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 300
+ snapMode: ListView.SnapToItem
+ spacing: 100
+ model: 10
+ delegate: Rectangle {
+ height: 100
+ width: 100
+ color: "blue"
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/stickyPositioning-both.qml b/tests/auto/quick/qquicklistview/data/stickyPositioning-both.qml
index f57927dbe7..57e7578ba5 100644
--- a/tests/auto/quick/qquicklistview/data/stickyPositioning-both.qml
+++ b/tests/auto/quick/qquicklistview/data/stickyPositioning-both.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/stickyPositioning-footer.qml b/tests/auto/quick/qquicklistview/data/stickyPositioning-footer.qml
index af5a6174f9..fd815ea79e 100644
--- a/tests/auto/quick/qquicklistview/data/stickyPositioning-footer.qml
+++ b/tests/auto/quick/qquicklistview/data/stickyPositioning-footer.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/stickyPositioning-header.qml b/tests/auto/quick/qquicklistview/data/stickyPositioning-header.qml
index cfd0f3dd44..94fb294474 100644
--- a/tests/auto/quick/qquicklistview/data/stickyPositioning-header.qml
+++ b/tests/auto/quick/qquicklistview/data/stickyPositioning-header.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
new file mode 100644
index 0000000000..338af38475
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 400
+ focus: true
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveVelocity: 200
+ preferredHighlightBegin: 150
+ preferredHighlightEnd: 150
+
+ property bool completed
+ Component.onCompleted: completed = true
+
+ model: 10
+ delegate: Item {
+ width: parent.width
+ height: ListView.isCurrentItem ? 100 : 50
+
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+
+ Behavior on height {
+ enabled: completed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/unrequestedItems.qml b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
index e3719a8be0..e6cb856c1e 100644
--- a/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
+++ b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 240
@@ -34,7 +35,7 @@ Item {
}
- VisualDataModel {
+ DelegateModel {
id: visualModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquicklistview/data/usechooserwithoutdefault.qml b/tests/auto/quick/qquicklistview/data/usechooserwithoutdefault.qml
new file mode 100644
index 0000000000..45164222f2
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/usechooserwithoutdefault.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Window 2.3
+import Qt.labs.qmlmodels 1.0
+
+Item {
+ width: 640
+ height: 450
+
+ ListView {
+ width: 600
+ height: 400
+ model: 2
+ delegate: DelegateChooser {
+ DelegateChoice {
+ index: 0
+ delegate: Rectangle {
+ width: 100
+ height: 100
+ color:"green"
+ }
+ }
+ }
+ }
+}