diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-07-19 11:25:10 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-07-19 13:44:53 +0000 |
commit | 31c42feafad17dd940e0eb593e3216c07520cef2 (patch) | |
tree | 474ffaa2d13d1bca42704dc005c2cbae8ac4fae7 /tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | |
parent | c1a293f752c73c38ae372aaff51ae5067e0c5143 (diff) |
tst_qquicktableview: actually test that model is reset
I added the test but didn't call beginResetModel()/endResetModel()...
whoops.
Change-Id: Ia74a83562c2df689b4bbc00df1b7181b40e82d87
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktableview/tst_qquicktableview.cpp')
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 9ba8d8a394..ba9638e6cb 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -1066,11 +1066,26 @@ void tst_QQuickTableView::modelSignals() QCOMPARE(tableView->columns(), 10); model.setColumnCount(0); - // TODO: When the QAbstractItemModel's column count is set to 0, - // QQmlAdaptorModel::columnCount() likes to return whatever it was previously, - // even though the model doesn't actually have any columns... not sure what to do about that. + WAIT_UNTIL_POLISHED; + // When the QAbstractItemModel's column count is set to 0, + // QQmlAdaptorModel::columnCount() returns 1 as long as it is "valid". QCOMPARE(tableView->rows(), 0); + QCOMPARE(tableView->columns(), 1); + + model.setRowCount(10); + WAIT_UNTIL_POLISHED; + QCOMPARE(tableView->rows(), 10); + QCOMPARE(tableView->columns(), 1); + + model.setColumnCount(10); + WAIT_UNTIL_POLISHED; + QCOMPARE(tableView->rows(), 10); QCOMPARE(tableView->columns(), 10); + + model.clear(); + WAIT_UNTIL_POLISHED; + QCOMPARE(tableView->rows(), 0); + QCOMPARE(tableView->columns(), 1); } QTEST_MAIN(tst_QQuickTableView) |