diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-28 12:12:59 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-28 12:12:59 (GMT) |
commit | 8bde410a6d0b1510d182a365d769db182b1c07dd (patch) | |
tree | 8bd7f8b375d23c5a7f723b86c7a1f5980babd111 /tests/auto/qtableview | |
parent | a8065da96b96fcc4baeca7615c2a4195c05cbc03 (diff) | |
download | Qt-8bde410a6d0b1510d182a365d769db182b1c07dd.zip Qt-8bde410a6d0b1510d182a365d769db182b1c07dd.tar.gz Qt-8bde410a6d0b1510d182a365d769db182b1c07dd.tar.bz2 |
Fixed the sizehint for cols/rows in qtableview
It could return wrong values because we were not always checking
the right cols/rows.
Reviewed-By: gabi
Task-Number: QTBUG-10169
Diffstat (limited to 'tests/auto/qtableview')
-rw-r--r-- | tests/auto/qtableview/tst_qtableview.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 2062e8e..3e5d077 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -202,6 +202,7 @@ private slots: void taskQTBUG_8585_crashForNoGoodReason(); void taskQTBUG_7774_RtoLVisualRegionForSelection(); void taskQTBUG_8777_scrollToSpans(); + void taskQTBUG_10169_sizeHintForRow(); void mouseWheel_data(); void mouseWheel(); @@ -478,6 +479,11 @@ public: return QTableView::selectedIndexes(); } + int sizeHintForRow(int row) const + { + return QTableView::sizeHintForRow(row); + } + bool checkSignalOrder; public slots: void currentChanged(QModelIndex , QModelIndex ) { @@ -4042,5 +4048,20 @@ void tst_QTableView::taskQTBUG_8777_scrollToSpans() QVERIFY(table.verticalScrollBar()->value() > 10); } +void tst_QTableView::taskQTBUG_10169_sizeHintForRow() +{ + QtTestTableView tableView; + QStandardItemModel model(1, 3); + model.setData(model.index(0, 0), "Word wrapping text goes here."); + tableView.setModel(&model); + tableView.verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); + const int orderedHeight = tableView.sizeHintForRow(0); + tableView.horizontalHeader()->moveSection(2, 0); + const int reorderedHeight = tableView.sizeHintForRow(0); + + //the order of the columns shouldn't matter. + QCOMPARE(orderedHeight, reorderedHeight); +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" |