diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-28 12:12:59 (GMT) |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 10:05:46 (GMT) |
commit | b775df59b34cdf53e5bc9a7e6108533f443fe8b4 (patch) | |
tree | b09d65ec38e48acb140e575493778e031a44e73e /tests/auto/qtableview | |
parent | 06c7dbe99d2079ab00ae56f40c429985fa5deb46 (diff) | |
download | Qt-b775df59b34cdf53e5bc9a7e6108533f443fe8b4.zip Qt-b775df59b34cdf53e5bc9a7e6108533f443fe8b4.tar.gz Qt-b775df59b34cdf53e5bc9a7e6108533f443fe8b4.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
(cherry picked from commit 8bde410a6d0b1510d182a365d769db182b1c07dd)
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 9b799bc..4809fe8 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" |