aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-11 01:00:18 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-11 01:00:19 +0200
commit66db74e53e3fa4aedeb519b8c8626066e1d6a1ce (patch)
tree619645d587124358a835341691ee20559865aea8 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parentbdc12f241118304a644f433bc3b75085c27a261d (diff)
parent45f95e74297ab3778965319c175a6d726f9c8afe (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 3ddfe1b923..fb5ae168e8 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -1946,6 +1946,31 @@ void tst_QQuickListView::enforceRange()
QTRY_COMPARE(listview->currentIndex(), 6);
+ // Test for [QTBUG-77418] {
+ // explicit set current index
+ listview->setCurrentIndex(5);
+ QTRY_COMPARE(listview->contentY(), 0);
+
+ // then check if contentY changes if the highlight range is changed
+ listview->setPreferredHighlightBegin(80);
+ listview->setPreferredHighlightEnd(80);
+ QTRY_COMPARE(listview->contentY(), 20);
+
+ // verify that current index does not change with no highlight
+ listview->setHighlightRangeMode(QQuickListView::NoHighlightRange);
+ listview->setContentY(100);
+ QTRY_COMPARE(listview->currentIndex(), 5);
+
+ // explicit set current index, contentY should not change now
+ listview->setCurrentIndex(6);
+ QTRY_COMPARE(listview->contentY(), 100);
+ QTest::qWait(50); // This was needed in order to reproduce a failure for the following test
+
+ // verify that contentY changes if we turn on highlight again
+ listview->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
+ QTRY_COMPARE(listview->contentY(), 40);
+ // } Test for [QTBUG-77418]
+
// change model
QaimModel model2;
for (int i = 0; i < 5; i++)