aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-30 10:42:34 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-02-02 15:59:32 +0100
commita9a9fa0c4737017aa4fc72b467eb45645d0912f0 (patch)
tree4753218705648384e6555be0e2bf3165bfb391d9 /tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
parenteace041161a03a849d3896af65493b7885cecc04 (diff)
parente6d4df156e9aec62054740dc99ab8ba2855eaafc (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp src/qml/compiler/qqmlirbuilder.cpp src/qml/compiler/qqmlirbuilder_p.h src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4compilercontext_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/compiler/qv4jsir_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtimecodegen.cpp src/qml/jsruntime/qv4script.cpp src/qml/jsruntime/qv4script_p.h src/qml/qml/qqmltypeloader.cpp src/quick/items/qquickanimatedimage.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp tests/auto/qml/qmlplugindump/qmlplugindump.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp tools/qmljs/qmljs.cpp Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
Diffstat (limited to 'tests/auto/quick/qquickgridview/tst_qquickgridview.cpp')
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 2a4a9dbdd9..ce04dc3c80 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -210,6 +210,7 @@ private slots:
void contentHeightWithDelayRemove();
void QTBUG_45640();
+ void QTBUG_49218();
void QTBUG_48870_fastModelUpdates();
void keyNavigationEnabled();
@@ -6629,6 +6630,36 @@ void tst_QQuickGridView::QTBUG_45640()
delete window;
}
+void tst_QQuickGridView::QTBUG_49218()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("qtbug49218.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QQuickGridView *gridview = qobject_cast<QQuickGridView *>(rootItem->childItems().first());
+ QVERIFY(gridview != 0);
+
+ auto processEventsAndForceLayout = [&gridview] () {
+ for (int pass = 0; pass < 2; ++pass) {
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
+ gridview->forceLayout();
+ }
+ };
+ QMetaObject::invokeMethod(rootItem, "scrollToTop");
+ processEventsAndForceLayout();
+ QMetaObject::invokeMethod(rootItem, "changeModel");
+ processEventsAndForceLayout();
+ QMetaObject::invokeMethod(rootItem, "changeModel");
+ processEventsAndForceLayout();
+ QMetaObject::invokeMethod(rootItem, "scrollToTop");
+ processEventsAndForceLayout();
+
+ QCOMPARE(gridview->indexAt(gridview->cellWidth() - 10, gridview->cellHeight() - 10), 0);
+ delete window;
+}
+
void tst_QQuickGridView::keyNavigationEnabled()
{
QScopedPointer<QQuickView> window(createView());