summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-13 16:06:09 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-13 16:06:09 (GMT)
commit8ae82b0c16aa1bdd9b8c88ef5c3cd889b4cdac7a (patch)
tree5bbb97ef498f8c303f4586abb35bb6ffb7fca702 /tests/auto/declarative
parenta65cee5791c6af16485d38bfe31e8cd01b9e1295 (diff)
parent896cd4bd08181ad16ad9cee6d2aaa1844a4f06d3 (diff)
downloadQt-8ae82b0c16aa1bdd9b8c88ef5c3cd889b4cdac7a.zip
Qt-8ae82b0c16aa1bdd9b8c88ef5c3cd889b4cdac7a.tar.gz
Qt-8ae82b0c16aa1bdd9b8c88ef5c3cd889b4cdac7a.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml37
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp20
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml
new file mode 100644
index 0000000..0756618
--- /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/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index ff90d32..b834d46 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -104,6 +104,7 @@ private slots:
void sizeLessThan1();
void QTBUG_14821();
void resizeDelegate();
+ void QTBUG_16037();
private:
template <class T> void items();
@@ -1944,6 +1945,25 @@ void tst_QDeclarativeListView::resizeDelegate()
delete canvas;
}
+void tst_QDeclarativeListView::QTBUG_16037()
+{
+ QDeclarativeView *canvas = createView();
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug16037.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "listview");
+ QTRY_VERIFY(listview != 0);
+
+ QVERIFY(listview->contentHeight() <= 0.0);
+
+ QMetaObject::invokeMethod(canvas->rootObject(), "setModel");
+
+ QTRY_COMPARE(listview->contentHeight(), 80.0);
+
+ delete canvas;
+}
+
void tst_QDeclarativeListView::qListModelInterface_items()
{
items<TestModel>();