From 752c0d7de0fb92124e2251a19841e308c6874159 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 24 Jul 2015 15:39:39 +0200 Subject: tests/corelib: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Tests from corelib/tools were omitted in this change. Change-Id: I4c8786d33fcf429d11b2b624c7cd89c28cadb518 Reviewed-by: Thiago Macieira --- .../tst_qidentityproxymodel.cpp | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp') diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index 9eb3bc5113..208214fbc5 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -111,25 +111,25 @@ void tst_QIdentityProxyModel::verifyIdentity(QAbstractItemModel *model, const QM const int columns = model->columnCount(parent); const QModelIndex proxyParent = m_proxy->mapFromSource(parent); - QVERIFY(m_proxy->mapToSource(proxyParent) == parent); - QVERIFY(rows == m_proxy->rowCount(proxyParent)); - QVERIFY(columns == m_proxy->columnCount(proxyParent)); + QCOMPARE(m_proxy->mapToSource(proxyParent), parent); + QCOMPARE(rows, m_proxy->rowCount(proxyParent)); + QCOMPARE(columns, m_proxy->columnCount(proxyParent)); for (int row = 0; row < rows; ++row) { for (int column = 0; column < columns; ++column) { const QModelIndex idx = model->index(row, column, parent); const QModelIndex proxyIdx = m_proxy->mapFromSource(idx); - QVERIFY(proxyIdx.model() == m_proxy); - QVERIFY(m_proxy->mapToSource(proxyIdx) == idx); + QCOMPARE(proxyIdx.model(), m_proxy); + QCOMPARE(m_proxy->mapToSource(proxyIdx), idx); QVERIFY(proxyIdx.isValid()); - QVERIFY(proxyIdx.row() == row); - QVERIFY(proxyIdx.column() == column); - QVERIFY(proxyIdx.parent() == proxyParent); - QVERIFY(proxyIdx.data() == idx.data()); - QVERIFY(proxyIdx.flags() == idx.flags()); + QCOMPARE(proxyIdx.row(), row); + QCOMPARE(proxyIdx.column(), column); + QCOMPARE(proxyIdx.parent(), proxyParent); + QCOMPARE(proxyIdx.data(), idx.data()); + QCOMPARE(proxyIdx.flags(), idx.flags()); const int childCount = m_proxy->rowCount(proxyIdx); const bool hasChildren = m_proxy->hasChildren(proxyIdx); - QVERIFY(model->hasChildren(idx) == hasChildren); + QCOMPARE(model->hasChildren(idx), hasChildren); QVERIFY((childCount > 0) == hasChildren); if (hasChildren) @@ -171,13 +171,13 @@ void tst_QIdentityProxyModel::insertRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value() == m_proxy->mapToSource(proxyAfterSpy.first().first().value())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value(), m_proxy->mapToSource(proxyAfterSpy.first().first().value())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); verifyIdentity(m_model); } @@ -216,13 +216,13 @@ void tst_QIdentityProxyModel::removeRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value() == m_proxy->mapToSource(proxyAfterSpy.first().first().value())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value(), m_proxy->mapToSource(proxyAfterSpy.first().first().value())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); verifyIdentity(m_model); } @@ -271,17 +271,17 @@ void tst_QIdentityProxyModel::moveRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); - QVERIFY(modelBeforeSpy.first().at(3).value() == m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value())); - QVERIFY(modelBeforeSpy.first().at(4) == proxyBeforeSpy.first().at(4)); + QCOMPARE(modelBeforeSpy.first().first().value(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().at(3).value(), m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value())); + QCOMPARE(modelBeforeSpy.first().at(4), proxyBeforeSpy.first().at(4)); - QVERIFY(modelAfterSpy.first().first().value() == m_proxy->mapToSource(proxyAfterSpy.first().first().value())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().at(3).value() == m_proxy->mapToSource(proxyAfterSpy.first().at(3).value())); - QVERIFY(modelAfterSpy.first().at(4) == proxyAfterSpy.first().at(4)); + QCOMPARE(modelAfterSpy.first().first().value(), m_proxy->mapToSource(proxyAfterSpy.first().first().value())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().at(3).value(), m_proxy->mapToSource(proxyAfterSpy.first().at(3).value())); + QCOMPARE(modelAfterSpy.first().at(4), proxyAfterSpy.first().at(4)); verifyIdentity(&model); @@ -352,7 +352,7 @@ void tst_QIdentityProxyModel::dataChanged() model.changeData(); QCOMPARE(modelSpy.first().at(2).value >(), QVector() << 1); - QVERIFY(modelSpy.first().at(2) == proxySpy.first().at(2)); + QCOMPARE(modelSpy.first().at(2), proxySpy.first().at(2)); verifyIdentity(&model); m_proxy->setSourceModel(0); -- cgit v1.2.3