summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-12-01 23:00:17 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-12-01 23:00:17 (GMT)
commitdfe2b6b4fb53e973aa455e1fe214925dfe03de9f (patch)
treef17ce7854f2bb27822237f7f4126e1356404112b /tests
parent9d9152a4c0fd3752418662b0fcdd77b3906d9b5b (diff)
parent49187bc691e67dca741d300e95d5fcde146d5118 (diff)
downloadQt-dfe2b6b4fb53e973aa455e1fe214925dfe03de9f.zip
Qt-dfe2b6b4fb53e973aa455e1fe214925dfe03de9f.tar.gz
Qt-dfe2b6b4fb53e973aa455e1fe214925dfe03de9f.tar.bz2
Merge branch '4.7-upstream' into 4.7-water
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/header1.qml33
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp67
2 files changed, 82 insertions, 18 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/header1.qml b/tests/auto/declarative/qdeclarativelistview/data/header1.qml
new file mode 100644
index 0000000..f2ab4c1
--- /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/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 295a75d..759caf2 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1664,32 +1664,63 @@ void tst_QDeclarativeListView::QTBUG_11105()
void tst_QDeclarativeListView::header()
{
- QDeclarativeView *canvas = createView();
+ {
+ QDeclarativeView *canvas = createView();
- TestModel model;
- for (int i = 0; i < 30; i++)
- model.addItem("Item" + QString::number(i), "");
+ TestModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
- QDeclarativeContext *ctxt = canvas->rootContext();
- ctxt->setContextProperty("testModel", &model);
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
- qApp->processEvents();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+ qApp->processEvents();
- QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
- QTRY_VERIFY(listview != 0);
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
- QDeclarativeItem *contentItem = listview->contentItem();
- QTRY_VERIFY(contentItem != 0);
+ QDeclarativeItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
- QDeclarativeText *header = findItem<QDeclarativeText>(contentItem, "header");
- QVERIFY(header);
- QCOMPARE(header->y(), 0.0);
+ QDeclarativeText *header = findItem<QDeclarativeText>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), 0.0);
- QCOMPARE(listview->contentY(), 0.0);
+ QCOMPARE(listview->contentY(), 0.0);
- model.clear();
- QTRY_COMPARE(header->y(), 0.0);
+ model.clear();
+ QTRY_COMPARE(header->y(), 0.0);
+
+ delete canvas;
+ }
+ {
+ QDeclarativeView *canvas = createView();
+
+ TestModel model;
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header1.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QDeclarativeItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QDeclarativeText *header = findItem<QDeclarativeText>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), 0.0);
+
+ QCOMPARE(listview->contentY(), 0.0);
+
+ model.clear();
+ QTRY_COMPARE(header->y(), 0.0);
+
+ delete canvas;
+ }
}
void tst_QDeclarativeListView::footer()