aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-02-15 17:20:20 +0100
committerSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-03-03 12:02:00 +0100
commit3214689afd5d34ca65e657c1f22127d92fce4b2b (patch)
treeba84dafa211e2294b3e7911e69f4d92ed4c65eb1 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent05f56d7c78754855c643470ad4e8dfd35c96f927 (diff)
Fix content position of list view
The content position of list view is incorrect, if populate animation is configured with BottomToTop or RightToLeft layout direction. This is because, we are not setting internal position for first item in the list view. This patch will set correct internal postion to the first item in list view. Fixes: QTBUG-111050 Change-Id: I1a233a938e2c088d176d79871a08bcd2a8edd6b3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 8a3a23826d..8bdd8fbcba 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -187,6 +187,7 @@ private slots:
void populateTransitions();
void populateTransitions_data();
+ void repositionFirstItemOnPopulateTransition();
void sizeTransitions();
void sizeTransitions_data();
@@ -6792,6 +6793,20 @@ void tst_QQuickListView::populateTransitions_data()
QTest::newRow("empty to start with, no populate") << false << false << false;
}
+// QTBUG-111050
+/* Reposition first visible item in list view on populate transition
+ Note: Occurs only in BottomToTop or RightToLeft layout */
+void tst_QQuickListView::repositionFirstItemOnPopulateTransition()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("repositionListViewOnPopulateTransition.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QTRY_VERIFY(listview != nullptr);
+ QTRY_COMPARE(listview->contentY(), -100.0);
+}
/*
* Tests if the first visible item is not repositioned if the same item