aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelistview/data
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit885735d011472bcfbb96e688d9e64553d7fe9d4b (patch)
tree734963625eba643bf11bc4870a4c407809a6400a /tests/auto/declarative/qdeclarativelistview/data
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistview/data')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml24
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/displaylist.qml50
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/footer.qml38
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/header.qml38
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/header1.qml33
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml26
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/itemlist.qml43
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml55
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml51
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml50
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml64
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml69
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml132
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml47
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/orientchange.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml71
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml31
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml37
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml42
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/sizelessthan1.qml26
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml29
21 files changed, 963 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml b/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml
new file mode 100644
index 0000000000..5ca1a45839
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml
@@ -0,0 +1,24 @@
+import QtQuick 1.0
+
+ListView {
+ id: view
+ width: 240; height: 320
+
+ property variant addedDelegates: []
+ property int removedDelegateCount
+
+ model: testModel
+
+ delegate: Rectangle {
+ width: 200; height: delegateHeight
+ border.width: 1
+ ListView.onAdd: {
+ var obj = ListView.view.addedDelegates
+ obj.push(model.name)
+ ListView.view.addedDelegates = obj
+ }
+ ListView.onRemove: {
+ view.removedDelegateCount += 1
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml
new file mode 100644
index 0000000000..9d58530252
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml
@@ -0,0 +1,50 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: root
+ property real delegateHeight: 20
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: root.delegateHeight
+ Behavior on height { NumberAnimation {} }
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ objectName: "displayText"
+ text: display
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ },
+ Component {
+ id: myHighlight
+ Rectangle { color: "green" }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ highlight: myHighlight
+ highlightMoveSpeed: 1000
+ highlightResizeSpeed: 1000
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/footer.qml b/tests/auto/declarative/qdeclarativelistview/data/footer.qml
new file mode 100644
index 0000000000..33e04f1b0a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/footer.qml
@@ -0,0 +1,38 @@
+import QtQuick 1.0
+
+Rectangle {
+ function changeFooter() {
+ list.footer = footer2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ footer: Text { objectName: "footer"; text: "Footer"; height: 30 }
+ }
+
+ Component {
+ id: footer2
+ Text { objectName: "footer2"; text: "Footer 2"; height: 20 }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/header.qml b/tests/auto/declarative/qdeclarativelistview/data/header.qml
new file mode 100644
index 0000000000..38cdd6e0c4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/header.qml
@@ -0,0 +1,38 @@
+import QtQuick 1.0
+
+Rectangle {
+ function changeHeader() {
+ list.header = header2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 30
+ width: 240
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ snapMode: ListView.SnapToItem
+ model: testModel
+ delegate: myDelegate
+ header: Text { objectName: "header"; text: "Header"; height: 20 }
+ }
+ Component {
+ id: header2
+ Text { objectName: "header2"; text: "Header 2"; height: 10 }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/header1.qml b/tests/auto/declarative/qdeclarativelistview/data/header1.qml
new file mode 100644
index 0000000000..f2ab4c1257
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/header1.qml
@@ -0,0 +1,33 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ ListModel { id: testModel }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: parent.width
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ model: testModel
+ delegate: Text {
+ objectName: "wrapper"
+ font.pointSize: 20
+ text: index
+ }
+ footer: Rectangle {
+ width: parent.width
+ height: 40
+ color: "green"
+ }
+ header: Text { objectName: "header"; text: "Header" }
+ }
+
+ Component.onCompleted: {
+ for (var i=0; i<30; i++) testModel.append({"name" : i, "val": i})
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml b/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml
new file mode 100644
index 0000000000..5633831925
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.1
+
+ListView {
+ id: view
+ property bool horizontal: false
+ property bool rtl: false
+ width: 240
+ height: 320
+
+ orientation: horizontal ? ListView.Horizontal : ListView.Vertical
+ header: Rectangle {
+ objectName: "header"
+ width: horizontal ? 20 : view.width
+ height: horizontal ? view.height : 20
+ color: "red"
+ }
+ footer: Rectangle {
+ objectName: "footer"
+ width: horizontal ? 30 : view.width
+ height: horizontal ? view.height : 30
+ color: "blue"
+ }
+// model: testModel
+ delegate: Text { width: 30; height: 30; text: index + "(" + x + ")" }
+ layoutDirection: rtl ? Qt.RightToLeft : Qt.LeftToRight
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml
new file mode 100644
index 0000000000..fca2901e97
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml
@@ -0,0 +1,43 @@
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 1.0
+
+Rectangle {
+ color: "lightgray"
+ width: 240
+ height: 320
+
+ VisualItemModel {
+ id: itemModel
+ objectName: "itemModel"
+ Rectangle {
+ objectName: "item1"
+ height: ListView.view.height; width: view.width; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: ListView.view.height; width: view.width; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: ListView.view.height; width: view.width; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ ListView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: 0
+ highlightRangeMode: "StrictlyEnforceRange"
+ orientation: ListView.Horizontal
+ flickDeceleration: 2000
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml
new file mode 100644
index 0000000000..49dbcb38ea
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml
@@ -0,0 +1,55 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ }
+
+ Component {
+ id: myHighlight
+ Rectangle {
+ color: "lightsteelblue"
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ highlight: myHighlight
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml
new file mode 100644
index 0000000000..2c4cfab217
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml
@@ -0,0 +1,51 @@
+import QtQuick 1.0
+
+Rectangle {
+ property int current: list.currentIndex
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ currentIndex: 20
+ width: 240
+ height: 320
+ keyNavigationWraps: testWrap
+ delegate: myDelegate
+ highlightMoveSpeed: 1000
+ model: testModel
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml
new file mode 100644
index 0000000000..19970100f7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml
@@ -0,0 +1,50 @@
+import QtQuick 1.0
+
+Rectangle {
+ property int current: list.currentIndex
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ currentIndex: -1
+ width: 240
+ height: 320
+ delegate: myDelegate
+ highlightMoveSpeed: 1000
+ model: testModel
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml
new file mode 100644
index 0000000000..283678b6f1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml
@@ -0,0 +1,64 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: ListView.previousSection != ListView.section ? 40 : 20;
+ width: 240
+ Rectangle {
+ y: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ height: 20
+ width: parent.width
+ color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 100
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ objectName: "nextSection"
+ x: 150
+ text: wrapper.ListView.nextSection
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ Rectangle {
+ color: "#99bb99"
+ height: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ width: parent.width
+ visible: wrapper.ListView.previousSection != wrapper.ListView.section ? true : false
+ Text { text: wrapper.ListView.section }
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ section.property: "number"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml
new file mode 100644
index 0000000000..b2d9213c3d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml
@@ -0,0 +1,69 @@
+import QtQuick 1.0
+
+Rectangle {
+ property string sectionProperty: "number"
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20;
+ width: 240
+ Rectangle {
+ height: 20
+ width: parent.width
+ color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 100
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ objectName: "nextSection"
+ x: 150
+ text: wrapper.ListView.nextSection
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "height"; to: 0; duration: 100; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ section.property: sectionProperty
+ section.delegate: Rectangle {
+ objectName: "sect_" + section
+ color: "#99bb99"
+ height: 20
+ width: list.width
+ Text { text: section }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
new file mode 100644
index 0000000000..3cd6f42f49
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
@@ -0,0 +1,132 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ property bool showHeader: false
+ property bool showFooter: false
+ property real hr: list.visibleArea.heightRatio
+ function heightRatio() {
+ return list.visibleArea.heightRatio
+ }
+
+ function checkProperties() {
+ testObject.error = false;
+ if (list.model != testModel) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ if (!testObject.animate && list.delegate != myDelegate) {
+ console.log("delegate property incorrect - expected myDelegate");
+ testObject.error = true;
+ }
+ if (testObject.animate && list.delegate != animatedDelegate) {
+ console.log("delegate property incorrect - expected animatedDelegate");
+ testObject.error = true;
+ }
+ if (testObject.invalidHighlight && list.highlight != invalidHl) {
+ console.log("highlight property incorrect - expected invalidHl");
+ testObject.error = true;
+ }
+ if (!testObject.invalidHighlight && list.highlight != myHighlight) {
+ console.log("highlight property incorrect - expected myHighlight");
+ testObject.error = true;
+ }
+ }
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ },
+ Component {
+ id: animatedDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+
+ }
+ }
+ },
+ Component {
+ id: myHighlight
+ Rectangle { color: "green" }
+ },
+ Component {
+ id: invalidHl
+ SmoothedAnimation {}
+ },
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: testObject.animate ? animatedDelegate : myDelegate
+ highlight: testObject.invalidHighlight ? invalidHl : myHighlight
+ highlightMoveSpeed: 1000
+ highlightResizeSpeed: 1000
+ cacheBuffer: testObject.cacheBuffer
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
new file mode 100644
index 0000000000..a32a19492c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
@@ -0,0 +1,47 @@
+import QtQuick 1.0
+
+Item {
+
+ ListModel {
+ id: model
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bob Brown"
+ number: "555 5845"
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ objectName: "highlight"
+ width: 180; height: 20
+ color: "lightsteelblue"; radius: 5
+ y: list.currentItem.y+5
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ model: model
+ delegate: Text { objectName: "wrapper"; text: name }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+ }
+
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml
new file mode 100644
index 0000000000..c7aa0cd1d3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+ListView {
+ width: 240; height: 320
+ delegate: Rectangle { objectName: "wrapper"; width: 80; height: 80 }
+ model: 100
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml b/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml
new file mode 100644
index 0000000000..04bec59abf
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml
@@ -0,0 +1,71 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 180; height: 120; color: "white"
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+ Component {
+ id: highlightRed
+ Rectangle {
+ color: "red"
+ radius: 10
+ opacity: 0.5
+ }
+ }
+ ListView {
+ objectName: "listView"
+ anchors.fill: parent
+ model: listModel
+ delegate: delegate
+ highlight: highlightRed
+ focus: true
+ highlightFollowsCurrentItem: true
+ preferredHighlightBegin: 0.0
+ preferredHighlightEnd: 0.0
+ highlightRangeMode: ListView.ApplyRange
+ keyNavigationWraps: true
+ cacheBuffer: 10
+ snapMode: ListView.SnapToItem
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ }
+ ]
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml
new file mode 100644
index 0000000000..e0303ecaa3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+
+ListView {
+ id: view
+ width: 300; height: 200
+ focus: true
+ keyNavigationWraps: true
+
+ model: 100
+
+ preferredHighlightBegin: 90
+ preferredHighlightEnd: 110
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlight: Component {
+ Rectangle {
+ border.color: "blue"
+ border.width: 3
+ color: "transparent"
+ width: 300; height: 15
+ }
+ }
+
+ delegate: Component {
+ Item {
+ height: 15 + (view.currentIndex == index ? 20 : 0)
+ width: 200
+ Text { text: 'Index: ' + index; anchors.verticalCenter: parent.verticalCenter }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml
new file mode 100644
index 0000000000..0756618a60
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml
@@ -0,0 +1,37 @@
+import QtQuick 1.0
+
+Item {
+ width: 640
+ height: 480
+
+ function setModel() {
+ listView.model = listModel1
+ }
+
+ ListModel {
+ id: listModel1
+ ListElement { text: "Apple" }
+ ListElement { text: "Banana" }
+ ListElement { text: "Orange" }
+ ListElement { text: "Coconut" }
+ }
+
+ Rectangle {
+ width: 200
+ height: listView.contentHeight
+ color: "yellow"
+ anchors.centerIn: parent
+
+ ListView {
+ id: listView
+ objectName: "listview"
+ anchors.fill: parent
+
+ delegate: Item {
+ width: 200
+ height: 20
+ Text { text: model.text; anchors.centerIn: parent }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml
new file mode 100644
index 0000000000..1e92bb3cbd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml
@@ -0,0 +1,42 @@
+// This example demonstrates how item positioning
+// changes in right-to-left layout direction
+
+import QtQuick 1.1
+
+Rectangle {
+ color: "lightgray"
+ width: 640
+ height: 320
+
+ VisualItemModel {
+ 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 }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: view.height; width: 200; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.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 }
+ }
+ }
+
+ ListView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ highlightRangeMode: "StrictlyEnforceRange"
+ orientation: ListView.Horizontal
+ flickDeceleration: 2000
+ layoutDirection: Qt.RightToLeft
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/sizelessthan1.qml b/tests/auto/declarative/qdeclarativelistview/data/sizelessthan1.qml
new file mode 100644
index 0000000000..77bfef8e57
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/sizelessthan1.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 0.5
+ width: 240
+ color: ((index % 2) == 1 ? "red" : "blue")
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml
new file mode 100644
index 0000000000..bb77a77cf3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml
@@ -0,0 +1,29 @@
+import QtQuick 1.0
+
+ListView {
+ id: list
+ objectName: "list"
+ width: 320
+ height: 480
+
+ function fillModel() {
+ list.model.append({"col": "red"});
+ list.currentIndex = list.count-1
+ list.model.append({"col": "blue"});
+ list.currentIndex = list.count-1
+ list.model.append({"col": "green"});
+ list.currentIndex = list.count-1
+ }
+
+ model: ListModel { id: listModel } // empty model
+ delegate: Rectangle { id: wrapper; objectName: "wrapper"; color: col; width: 300; height: 400 }
+ orientation: "Horizontal"
+ snapMode: "SnapToItem"
+ cacheBuffer: 1000
+
+ preferredHighlightBegin: 10
+ preferredHighlightEnd: 10
+
+ highlightRangeMode: "StrictlyEnforceRange"
+ focus: true
+}