summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlistview
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-20 10:39:42 +0200
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-20 10:53:12 +0200
commit6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4 (patch)
tree63e4e72a6e74ddb58c44656937b9edbe5d5a4411 /tests/auto/qlistview
parente87b66fc81600e43eb1b9696c6e97d6c4ff4ab90 (diff)
Fixed wrong scrolling in QListView with hidden rows in ListMode
The flow positions in ScrollPerItem mode did not take the hidden rows into account when configuring the vertical scroll bar. A mapping between the scroll bar value and the flow position has been added. Auto-test included. Task-number: QTBUG-2233 Reviewed-by: Thierry
Diffstat (limited to 'tests/auto/qlistview')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 3ee6889f50..ed02317624 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -117,6 +117,7 @@ private slots:
void shiftSelectionWithNonUniformItemSizes();
void clickOnViewportClearsSelection();
void task262152_setModelColumnNavigate();
+ void taskQTBUG_2233_scrollHiddenRows();
};
// Testing get/set functions
@@ -1790,7 +1791,31 @@ void tst_QListView::task262152_setModelColumnNavigate()
}
+void tst_QListView::taskQTBUG_2233_scrollHiddenRows()
+{
+ const int rowCount = 200;
+
+ QListView view;
+ QStringListModel model(&view);
+ QStringList list;
+ for (int i = 0; i < rowCount; ++i)
+ list << QString::fromAscii("Item %1").arg(i);
+
+ model.setStringList(list);
+ view.setModel(&model);
+ view.setViewMode(QListView::ListMode);
+ view.setFlow(QListView::TopToBottom);
+ for (int i = 0; i < rowCount / 2; ++i)
+ view.setRowHidden(2 * i, true);
+ view.resize(250, 130);
+ for (int i = 0; i < 10; ++i) {
+ view.verticalScrollBar()->setValue(i);
+ QModelIndex index = view.indexAt(QPoint(20,0));
+ QVERIFY(index.isValid());
+ QCOMPARE(index.row(), 2 * i + 1);
+ }
+}
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"