summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-20 08:39:42 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-20 08:53:12 (GMT)
commit6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4 (patch)
tree63e4e72a6e74ddb58c44656937b9edbe5d5a4411 /tests/auto
parente87b66fc81600e43eb1b9696c6e97d6c4ff4ab90 (diff)
downloadQt-6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4.zip
Qt-6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4.tar.gz
Qt-6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4.tar.bz2
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')
-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 3ee6889..ed02317 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"