diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-02 14:25:19 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-02 14:54:47 (GMT) |
commit | 11dea4a8b227801c110f791f350632bf6f0c958d (patch) | |
tree | 246eeda8b829c4c0e66e40348b520c33559bcd80 /tests/auto | |
parent | 8abe466caa1b38f4cc1f95fba83d5e61e611e931 (diff) | |
download | Qt-11dea4a8b227801c110f791f350632bf6f0c958d.zip Qt-11dea4a8b227801c110f791f350632bf6f0c958d.tar.gz Qt-11dea4a8b227801c110f791f350632bf6f0c958d.tar.bz2 |
Fixed spacing display in QListView with wrapped text.
The spacing was not being substracted from the viewport width when calculating
the available space for items. Auto-test included.
Reviewed-by: Olivier
Task-number: QTBUG-2678
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index a5ff153..246f092 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -121,6 +121,7 @@ private slots: void taskQTBUG_2233_scrollHiddenItems(); void taskQTBUG_633_changeModelData(); void taskQTBUG_435_deselectOnViewportClick(); + void taskQTBUG_2678_spacingAndWrappedText(); }; // Testing get/set functions @@ -1876,5 +1877,19 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() QVERIFY(!view.selectionModel()->hasSelection()); } +void tst_QListView::taskQTBUG_2678_spacingAndWrappedText() +{ + static const QString lorem("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); + QStringListModel model(QStringList() << lorem << lorem << "foo" << lorem << "bar" << lorem << lorem); + QListView w; + w.setModel(&model); + w.setViewMode(QListView::ListMode); + w.setWordWrap(true); + w.setSpacing(10); + w.show(); + QTest::qWaitForWindowShown(&w); + QCOMPARE(w.horizontalScrollBar()->minimum(), w.horizontalScrollBar()->maximum()); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" |