diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-09 12:05:09 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-09 12:22:34 (GMT) |
commit | 997490b36b28bca877409de97a506c969840bc43 (patch) | |
tree | c04ad8e5768de23696aa143b6d0f6bc8f0c75f09 /tests/auto/qlistview | |
parent | 884a36d300bbe9068d912550a4aeb581f8ce8b37 (diff) | |
download | Qt-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/qlistview')
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 17 |
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() |