summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-02-09 12:05:09 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-02-09 12:22:34 (GMT)
commit997490b36b28bca877409de97a506c969840bc43 (patch)
treec04ad8e5768de23696aa143b6d0f6bc8f0c75f09 /tests/auto
parent884a36d300bbe9068d912550a4aeb581f8ce8b37 (diff)
downloadQt-997490b36b28bca877409de97a506c969840bc43.zip
Qt-997490b36b28bca877409de97a506c969840bc43.tar.gz
Qt-997490b36b28bca877409de97a506c969840bc43.tar.bz2
QListView: fix crash when hiding many of the lasts item in a QListView
Since 6c1388ee5a3c4796d hidden items are not taken in account when counting the scrollbar position, and so the vector may be smaller. Reviewed-by: Gabriel Task-number: QTBUG-7929
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 7109213..1e6d36a 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -1834,6 +1834,23 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
QVERIFY(index.isValid());
QCOMPARE(index.row(), 2 * i + 1);
}
+
+ //QTBUG-7929 should not crash
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QScrollBar *bar = view.flow() == QListView::TopToBottom
+ ? view.verticalScrollBar() : view.horizontalScrollBar();
+
+ int nbVisibleItem = rowCount / 2 - bar->maximum();
+
+ bar->setValue(bar->maximum());
+ QApplication::processEvents();
+ for (int i = rowCount; i > rowCount / 2; i--) {
+ view.setRowHidden(i, true);
+ }
+ QApplication::processEvents();
+ QCOMPARE(bar->value(), bar->maximum());
+ QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem);
}
void tst_QListView::taskQTBUG_633_changeModelData()