diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-04-08 10:11:44 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-04-08 10:11:44 (GMT) |
commit | 3c546be51dbdc1064a14cfcd178f7fbb5c6bff75 (patch) | |
tree | ef71de22ce4aa42726c2715b2bac42fe3f6646fb /tests/auto/qtreeview | |
parent | 4c425feb08cd4aad31a99e92fec3fbbde0349d95 (diff) | |
parent | d248e431e259cdb31c7634507a09a9f6d39711c3 (diff) | |
download | Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.zip Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.tar.gz Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index bdc0a0c..2de189d 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -237,6 +237,7 @@ private slots: void task245654_changeModelAndExpandAll(); void doubleClickedWithSpans(); void taskQTBUG_6450_selectAllWith1stColumnHidden(); + void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint(); }; class QtTestModel: public QAbstractItemModel @@ -3714,5 +3715,43 @@ void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex())); } +class TreeViewQTBUG_9216 : public QTreeView +{ + Q_OBJECT +public: + void paintEvent(QPaintEvent *event) + { + if (doCompare) + QCOMPARE(event->rect(), viewport()->rect()); + QTreeView::paintEvent(event); + painted++; + } + int painted; + bool doCompare; +}; + +void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() +{ + QStandardItemModel model(10, 10, this); + for (int row = 0; row < 10; row++) + for (int col = 0; col < 10; col++) + model.setItem(row, col, new QStandardItem(QString("row %0, col %1").arg(row).arg(col))); + TreeViewQTBUG_9216 view; + view.setUniformRowHeights(true); + view.setModel(&model); + view.painted = 0; + view.doCompare = false; + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.painted > 0); + + QTest::qWait(100); // This one is needed to make the test fail before the patch. + view.painted = 0; + view.doCompare = true; + model.setData(model.index(0, 0), QVariant(QSize(50, 50)), Qt::SizeHintRole); + QTest::qWait(100); + QTRY_VERIFY(view.painted > 0); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |