summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlistview/tst_qlistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qlistview/tst_qlistview.cpp')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 5cada02..c372475 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -104,6 +104,8 @@ private slots:
void emptyItemSize();
void task203585_selectAll();
void task228566_infiniteRelayout();
+ void task248430_crashWith0SizedItem();
+ void task250446_scrollChanged();
};
// Testing get/set functions
@@ -1517,6 +1519,42 @@ void tst_QListView::task228566_infiniteRelayout()
QCOMPARE(spy.count(), 0);
}
+void tst_QListView::task248430_crashWith0SizedItem()
+{
+ QListView view;
+ view.setViewMode(QListView::IconMode);
+ QStringListModel model(QStringList() << QLatin1String("item1") << QString());
+ view.setModel(&model);
+ view.show();
+ QTest::qWait(100);
+}
+
+void tst_QListView::task250446_scrollChanged()
+{
+ QStandardItemModel model(200, 1);
+ QListView view;
+ view.setModel(&model);
+ QModelIndex index = model.index(0, 0);
+ QVERIFY(index.isValid());
+ view.setCurrentIndex(index);
+ view.show();
+ QTest::qWait(100);
+ const int scrollValue = view.verticalScrollBar()->maximum();
+ view.verticalScrollBar()->setValue(scrollValue);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+
+ view.showMinimized();
+ QTest::qWait(100);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+
+ view.showNormal();
+ QTest::qWait(100);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+}
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"