aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qsggridview/tst_qsggridview.cpp')
-rw-r--r--tests/auto/declarative/qsggridview/tst_qsggridview.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
index f29eb33383..1200129e0b 100644
--- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
+++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
@@ -2459,17 +2459,15 @@ void tst_QSGGridView::header()
QFETCH(QPointF, firstDelegatePos);
QFETCH(QPointF, resizeContentPos);
- QSGView *canvas = createView();
-
TestModel model;
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QDeclarativeContext *ctxt = canvas->rootContext();
- ctxt->setContextProperty("testModel", &model);
-
+ QSGView *canvas = createView();
+ canvas->rootContext()->setContextProperty("testModel", &model);
+ canvas->rootContext()->setContextProperty("initialViewWidth", 240);
+ canvas->rootContext()->setContextProperty("initialViewHeight", 320);
canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
- qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
QTRY_VERIFY(gridview != 0);
@@ -2525,6 +2523,27 @@ void tst_QSGGridView::header()
QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
delete canvas;
+
+
+ // QTBUG-21207 header should become visible if view resizes from initial empty size
+
+ canvas = createView();
+ canvas->rootContext()->setContextProperty("testModel", &model);
+ canvas->rootContext()->setContextProperty("initialViewWidth", 240);
+ canvas->rootContext()->setContextProperty("initialViewHeight", 320);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+
+ gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+
+ gridview->setWidth(240);
+ gridview->setHeight(320);
+ QTRY_COMPARE(gridview->headerItem()->pos(), initialHeaderPos);
+ QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
+
+ delete canvas;
}
void tst_QSGGridView::header_data()