summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-15 09:05:05 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-15 12:36:37 (GMT)
commitb53f7d4ce3d5d9af47daf78c9f831acc532e688b (patch)
treeda3ab7cf2f7ef794c0cb6db744658f70a75427da /tests
parent97caf6916a830b70f6a40a99a55fd4500b163c37 (diff)
downloadQt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.zip
Qt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.tar.gz
Qt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.tar.bz2
QListView: Re-fix scrollbar ranges
Commit 11dea4a8b227801c110f791f350632bf6f0c958d fixing QTBUG-2678 was the wrong solution and introduced some regressions. Auto-test included. Reviewed-by: Thierry Task-number: QTBUG-2678 Task-number: QTBUG-9455
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index d2181f8..f5c32cd 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -123,6 +123,7 @@ private slots:
void taskQTBUG_435_deselectOnViewportClick();
void taskQTBUG_2678_spacingAndWrappedText();
void taskQTBUG_5877_skippingItemInPageDownUp();
+ void taskQTBUG_9455_wrongScrollbarRanges();
};
// Testing get/set functions
@@ -1941,5 +1942,34 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp()
}
}
+class ListView_9455 : public QListView
+{
+public:
+ QSize contentsSize() const
+ {
+ return QListView::contentsSize();
+ }
+};
+
+void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges()
+{
+ QStringList list;
+ const int nrItems = 8;
+ for (int i = 0; i < nrItems; i++)
+ list << QString().sprintf("item %d", i);
+
+ QStringListModel model(list);
+ ListView_9455 w;
+ w.setModel(&model);
+ w.setViewMode(QListView::IconMode);
+ w.resize(116, 132);
+ w.setMovement(QListView::Static);
+ const int spacing = 40;
+ w.setSpacing(spacing);
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ QCOMPARE(w.verticalScrollBar()->maximum(), w.contentsSize().height() - w.viewport()->geometry().height());
+}
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"