diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-03-24 13:57:11 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-03-24 13:57:11 (GMT) |
commit | 8c10e0b73c312a6c1aacce11cc8d6f57dc94a09d (patch) | |
tree | 08af12675b0b4789a26fedafb2839349af92e8bd | |
parent | 4e35b06fc52bf054ef3f23609fe698c6eb915dc9 (diff) | |
download | Qt-8c10e0b73c312a6c1aacce11cc8d6f57dc94a09d.zip Qt-8c10e0b73c312a6c1aacce11cc8d6f57dc94a09d.tar.gz Qt-8c10e0b73c312a6c1aacce11cc8d6f57dc94a09d.tar.bz2 |
Auto test for commit 4a4458d1cf5ec7885c6f63f739b7ee80c70ad211
Reviewed-by: Trust me
Task-number: QTBUG-9216
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index bdc0a0c..da99368 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,34 @@ void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex())); } +class TreeViewQTBUG_9216 : public QTreeView +{ + Q_OBJECT +public: + void paintEvent(QPaintEvent *event) + { + QCOMPARE(event->rect(), viewport()->rect()); + QTreeView::paintEvent(event); + } +}; + +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.resize(800, 800); + view.show(); + QTest::qWaitForWindowShown(&view); + + QTest::qWait(100); // This one is needed to make the test fail before the patch. + model.setData(model.index(0, 5), QVariant(QSize(100,100)), Qt::SizeHintRole); + QTest::qWait(100); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |