aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-03-16 17:01:11 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-19 10:49:05 +0100
commitf079f789c593996b0023afd6318d60d18ac66578 (patch)
treedeefb71d52fa338ad812e376d356fcd1de44b303 /tests
parentcbe346a906f025af932b67c7c9672b109e218fa0 (diff)
Ensure section header/footer are cleaned up.
If the model is cleared or replaced with an empty one, the section headers should be released. Change-Id: Ia2f070c312593743b2c5332a6c69facaf222ee6d Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 14707cab1d..335fc3c6e2 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2182,6 +2182,23 @@ void tst_QQuickListView::sectionsPositioning()
QTRY_VERIFY(item = findVisibleChild(contentItem, "sect_aaa")); // inline label restored
QCOMPARE(item->y(), 0.);
+ // if an empty model is set the header/footer should be cleaned up
+ canvas->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd)));
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ QmlListModel model1;
+ ctxt->setContextProperty("testModel", &model1);
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
+ // clear model - header/footer should be cleaned up
+ ctxt->setContextProperty("testModel", &model);
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ model.clear();
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
delete canvas;
}