summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qlistview
diff options
context:
space:
mode:
authorAleksei Ilin <Aleksei.Ilin@moex.com>2016-11-14 20:27:38 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2017-01-17 14:00:31 +0000
commit0243863382ab580a0d25c4df9e9bfa6e2f31c7cb (patch)
tree447b0b29e8a4b9cd4d6d34cee7fcef88132e9ec9 /tests/auto/widgets/itemviews/qlistview
parent117b3e1b8f43bea829b818e4c20645e8a8d1e8e6 (diff)
Fix access incorrect index in QListView with batch layout
The size of flowPositions is larger by one than the number of rows in the model so the last correct row number is flowPositions.count()-2, not flowPositions.count()-1. Change-Id: Idf8bbd155151d553947d5d299dd01ffaff0c95fa Task-number: QTBUG-47694 Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qlistview')
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 0f1c5723d5..6eed21abb2 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -150,6 +150,7 @@ private slots:
void horizontalScrollingByVerticalWheelEvents();
void taskQTBUG_7232_AllowUserToControlSingleStep();
void taskQTBUG_51086_skippingIndexesInSelectedIndexes();
+ void taskQTBUG_47694_indexOutOfBoundBatchLayout();
};
// Testing get/set functions
@@ -2486,5 +2487,18 @@ void tst_QListView::taskQTBUG_51086_skippingIndexesInSelectedIndexes()
QVERIFY(!indexes.contains(data.index(8, 0)));
}
+void tst_QListView::taskQTBUG_47694_indexOutOfBoundBatchLayout()
+{
+ QListView view;
+ view.setLayoutMode(QListView::Batched);
+ int batchSize = view.batchSize();
+
+ QStandardItemModel model(batchSize + 1, 1);
+
+ view.setModel(&model);
+
+ view.scrollTo(model.index(batchSize - 1, 0));
+}
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"