aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-11-25 23:54:47 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-26 01:13:00 +0100
commitf449534020adc8623ebfced5daae331ef56c4421 (patch)
treec74d78ce8307306339ff946d7c085629908f0b3a /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent21a03c02848bb35fe665223f49ba9643cce343b7 (diff)
Also update viewport size when header/footer size changes
Task-number: QTBUG-24292 Change-Id: I8e7f5abe077b6e8d2ce6625dcf43a34a7260934e Done-with: Martin Jones <martin.jones@jollamobile.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 6ec7cf8dc1..fb0b1c95ca 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -150,6 +150,7 @@ private slots:
void header();
void header_data();
void header_delayItemCreation();
+ void headerChangesViewport();
void footer();
void footer_data();
void extents();
@@ -3657,6 +3658,35 @@ void tst_QQuickListView::header_delayItemCreation()
delete window;
}
+void tst_QQuickListView::headerChangesViewport()
+{
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("headerHeight", 20);
+ window->rootContext()->setContextProperty("headerWidth", 240);
+ window->setSource(testFileUrl("headerchangesviewport.qml"));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *header = 0;
+ QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header"));
+ QVERIFY(header == listview->headerItem());
+
+ QCOMPARE(header->height(), 20.);
+ QCOMPARE(listview->contentHeight(), 20.);
+
+ // change height
+ window->rootContext()->setContextProperty("headerHeight", 50);
+
+ // verify that list content height updates also
+ QCOMPARE(header->height(), 50.);
+ QCOMPARE(listview->contentHeight(), 50.);
+}
+
void tst_QQuickListView::footer()
{
QFETCH(QQuickListView::Orientation, orientation);