From 96ec0ab8f0b2e53eff6e1887aff7e51601821845 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 20 Nov 2017 14:01:12 +0100 Subject: QQuickList/GridViewPrivate::fixupPosition: don't set moveReason In QQuickItemViewPrivate::applyModelChanges(), if moveReason = QQuickItemViewPrivate::Other, then QQuickItemView::trackedPositionChanged() will fail to call d->setPosition(pos), which is normally what keeps the Flickable moving for a while. Leave the reason as-is (it will be SetIndex in this case), so as not to forget that we were actually trying to move down when the sequence window->polishItems() -> QQIV::updatePolish() -> layout() -> fixupPosition() did its part of the work of moving down. Task-number: QTBUG-62864 Change-Id: I1021e2ea39265de9e1285e2ee17c5733189ab939 Reviewed-by: Shawn Rutledge --- tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 223f6004ff..73d831ecdd 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -255,6 +255,7 @@ private slots: void QTBUG_50105(); void keyNavigationEnabled(); void QTBUG_61269_appendDuringScrollDown(); + void QTBUG_61269_appendDuringScrollDown_data(); void QTBUG_50097_stickyHeader_positionViewAtIndex(); void QTBUG_63974_stickyHeader_positionViewAtIndex_Contain(); void itemFiltered(); @@ -8468,8 +8469,19 @@ void tst_QQuickListView::keyNavigationEnabled() QCOMPARE(listView->currentIndex(), 1); } -void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() +void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown_data() { + QTest::addColumn("snapMode"); + + QTest::newRow("NoSnap") << QQuickListView::NoSnap; + QTest::newRow("SnapToItem") << QQuickListView::SnapToItem; + QTest::newRow("SnapOneItem") << QQuickListView::SnapOneItem; +} + +void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() // AKA QTBUG-62864 +{ + QFETCH(QQuickListView::SnapMode, snapMode); + QScopedPointer window(createView()); window->setSource(testFileUrl("appendDuringScrollDown.qml")); window->show(); @@ -8477,6 +8489,7 @@ void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickListView *listView = qobject_cast(window->rootObject()); + listView->setSnapMode(snapMode); QQuickItem *highlightItem = listView->highlightItem(); QVERIFY(listView); QCOMPARE(listView->isKeyNavigationEnabled(), true); -- cgit v1.2.3