diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-24 15:39:39 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-19 19:06:33 +0000 |
commit | 752c0d7de0fb92124e2251a19841e308c6874159 (patch) | |
tree | db5562776e8de271508a4825ad71492b9de67bd9 /tests/auto/corelib/itemmodels | |
parent | 933745f36b0b21e0107553f2d056af32e643b7d7 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/itemmodels')
6 files changed, 89 insertions, 89 deletions
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index c4d2df7c3e..450a1f84c6 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1699,8 +1699,8 @@ void tst_QAbstractItemModel::testMoveToDescendants() moveCommand->setDestRow(row); moveCommand->doCommand(); - QVERIFY(beforeSpy.size() == 0); - QVERIFY(afterSpy.size() == 0); + QCOMPARE(beforeSpy.size(), 0); + QCOMPARE(afterSpy.size(), 0); } } } @@ -1757,8 +1757,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange() moveCommand->setDestRow(destRow); moveCommand->doCommand(); - QVERIFY(beforeSpy.size() == 0); - QVERIFY(afterSpy.size() == 0); + QCOMPARE(beforeSpy.size(), 0); + QCOMPARE(afterSpy.size(), 0); } class ListenerObject : public QObject @@ -1823,7 +1823,7 @@ void ListenerObject::slotAboutToBeReset() // Nothing has been changed yet. All indexes should be the same. for (int i = 0; i < m_persistentIndexes.size(); ++i) { QModelIndex idx = m_persistentIndexes.at(i); - QVERIFY(idx == m_nonPersistentIndexes.at(i)); + QCOMPARE(idx, m_nonPersistentIndexes.at(i)); QVERIFY(m_model->mapToSource(idx).isValid()); } } @@ -1859,13 +1859,13 @@ void tst_QAbstractItemModel::testReset() resetCommand->doCommand(); // Verify that the correct signals were emitted - QVERIFY(beforeResetSpy.size() == 1); - QVERIFY(afterResetSpy.size() == 1); + QCOMPARE(beforeResetSpy.size(), 1); + QCOMPARE(afterResetSpy.size(), 1); // Verify that the move actually happened. - QVERIFY(m_model->rowCount() == 9); + QCOMPARE(m_model->rowCount(), 9); QModelIndex destIndex = m_model->index(4, 0); - QVERIFY(m_model->rowCount(destIndex) == 11); + QCOMPARE(m_model->rowCount(destIndex), 11); // Delete it because its slots test things which are not true after this point. delete listener; @@ -1877,14 +1877,14 @@ void tst_QAbstractItemModel::testReset() QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray()); nullProxy->setSourceModel(new ModelWithCustomRole(this)); - QVERIFY(proxyBeforeResetSpy.size() == 1); - QVERIFY(proxyAfterResetSpy.size() == 1); + QCOMPARE(proxyBeforeResetSpy.size(), 1); + QCOMPARE(proxyAfterResetSpy.size(), 1); QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray("custom")); nullProxy->setSourceModel(m_model); - QVERIFY(proxyBeforeResetSpy.size() == 2); - QVERIFY(proxyAfterResetSpy.size() == 2); + QCOMPARE(proxyBeforeResetSpy.size(), 2); + QCOMPARE(proxyAfterResetSpy.size(), 2); // After being reset the proxy must be queried again. QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray()); @@ -2055,10 +2055,10 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged() QVERIFY(afterParents.contains(p2)); // The first will be the last, and the lest will be the first. - QVERIFY(p1FirstPersistent.row() == 1); - QVERIFY(p1LastPersistent.row() == 0); - QVERIFY(p2FirstPersistent.row() == 9); - QVERIFY(p2LastPersistent.row() == 8); + QCOMPARE(p1FirstPersistent.row(), 1); + QCOMPARE(p1LastPersistent.row(), 0); + QCOMPARE(p2FirstPersistent.row(), 9); + QCOMPARE(p2LastPersistent.row(), 8); } insertCommand = new ModelInsertCommand(&model, this); @@ -2115,8 +2115,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged() QCOMPARE(beforeSignal.size(), 2); QCOMPARE(afterSignal.size(), 2); - QVERIFY(p1FirstPersistent.row() == 1); - QVERIFY(p1LastPersistent.row() == 0); + QCOMPARE(p1FirstPersistent.row(), 1); + QCOMPARE(p1LastPersistent.row(), 0); QCOMPARE(p2FirstPersistent.row(), 9); QCOMPARE(p2LastPersistent.row(), 8); } diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index fb9d118d60..fbe123bca0 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -351,7 +351,7 @@ static void verifySubSetOf(const QHash<int, QByteArray> &superSet, const QHash<i const QHash<int, QByteArray>::const_iterator end = subSet.constEnd(); for ( ; it != end; ++it ) { QVERIFY(superSet.contains(it.key())); - QVERIFY(it.value() == superSet.value(it.key())); + QCOMPARE(it.value(), superSet.value(it.key())); } } 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<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + 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<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + 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<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); - QVERIFY(modelBeforeSpy.first().at(3).value<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(4) == proxyBeforeSpy.first().at(4)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().at(3).value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(4), proxyBeforeSpy.first().at(4)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().at(3).value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().at(3).value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(4) == proxyAfterSpy.first().at(4)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().at(3).value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().at(3).value<QModelIndex>())); + 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<int> >(), QVector<int>() << 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); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 709b35b6e0..1531e0ac40 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -351,7 +351,7 @@ void tst_QItemModel::index() // Make sure that the same index is always returned QModelIndex a = currentModel->index(0,0); QModelIndex b = currentModel->index(0,0); - QVERIFY(a == b); + QCOMPARE(a, b); // index is tested more extensivly more later in checkChildren(), // but this catches the big mistakes @@ -415,7 +415,7 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent, // Make sure we get the same index if we request it twice in a row QModelIndex a = currentModel->index(r, c, parent); QModelIndex b = currentModel->index(r, c, parent); - QVERIFY(a == b); + QCOMPARE(a, b); { const QModelIndex sibling = currentModel->sibling( r, c, topLeftChild ); @@ -427,7 +427,7 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent, } // Some basic checking on the index that is returned - QVERIFY(index.model() == currentModel); + QCOMPARE(index.model(), currentModel); QCOMPARE(index.row(), r); QCOMPARE(index.column(), c); QCOMPARE(currentModel->data(index, Qt::DisplayRole).isValid(), true); diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 23cd254477..3a0c8b83dd 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -1757,7 +1757,7 @@ void tst_QItemSelectionModel::modelLayoutChanged() // verify that selection is as expected QItemSelection selection = selectionModel.selection(); QCOMPARE(selection.count(), expectedSelectedRanges.count()); - QVERIFY(selectionModel.hasSelection() == !expectedSelectedRanges.isEmpty()); + QCOMPARE(selectionModel.hasSelection(), !expectedSelectedRanges.isEmpty()); for (int i = 0; i < expectedSelectedRanges.count(); ++i) { IntPairPair expectedRange = expectedSelectedRanges.at(i); @@ -2214,7 +2214,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged); QVERIFY(deselectSpy.isValid()); model.removeRows(0, 1, root); - QVERIFY(deselectSpy.count() == 1); + QCOMPARE(deselectSpy.count(), 1); // More testing stress for the patch. model.clear(); @@ -2242,7 +2242,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QVERIFY(selectionModel.selection().contains(sel2)); deselectSpy.clear(); model.removeRow(0, model.index(0, 0)); - QVERIFY(deselectSpy.count() == 1); + QCOMPARE(deselectSpy.count(), 1); QVERIFY(!selectionModel.selection().contains(sel)); QVERIFY(selectionModel.selection().contains(sel2)); } @@ -2372,7 +2372,7 @@ public slots: foreach(const QModelIndex &index, deselected.indexes()) { QVERIFY(!m_itemSelectionModel->selection().contains(index)); } - QVERIFY(m_itemSelectionModel->selection().size() == 2); + QCOMPARE(m_itemSelectionModel->selection().size(), 2); } }; @@ -2390,7 +2390,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange() selModel.select(QItemSelection(model.index(3, 0), model.index(6, 0)), QItemSelectionModel::Select); - QVERIFY(selModel.selection().size() == 1); + QCOMPARE(selModel.selection().size(), 1); RemovalObserver ro(&selModel); @@ -2399,7 +2399,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange() bool ok = model.removeRows(4, 2); QVERIFY(ok); - QVERIFY(spy.size() == 1); + QCOMPARE(spy.size(), 1); } static QStandardItemModel* getModel(QObject *parent) @@ -2710,8 +2710,8 @@ void tst_QItemSelectionModel::testChainedSelectionClear() QModelIndexList selectedIndexes = selectionModel.selection().indexes(); QModelIndexList duplicatedIndexes = duplicate.selection().indexes(); - QVERIFY(selectedIndexes.size() == duplicatedIndexes.size()); - QVERIFY(selectedIndexes.size() == 1); + QCOMPARE(selectedIndexes.size(), duplicatedIndexes.size()); + QCOMPARE(selectedIndexes.size(), 1); QVERIFY(selectedIndexes.first() == model.index(0, 0)); } @@ -2721,18 +2721,18 @@ void tst_QItemSelectionModel::testChainedSelectionClear() QModelIndexList selectedIndexes = selectionModel.selection().indexes(); QModelIndexList duplicatedIndexes = duplicate.selection().indexes(); - QVERIFY(selectedIndexes.size() == duplicatedIndexes.size()); - QVERIFY(selectedIndexes.size() == 0); + QCOMPARE(selectedIndexes.size(), duplicatedIndexes.size()); + QCOMPARE(selectedIndexes.size(), 0); } duplicate.setCurrentIndex(model.index(0, 0), QItemSelectionModel::NoUpdate); - QVERIFY(selectionModel.currentIndex() == duplicate.currentIndex()); + QCOMPARE(selectionModel.currentIndex(), duplicate.currentIndex()); duplicate.clearCurrentIndex(); QVERIFY(!duplicate.currentIndex().isValid()); - QVERIFY(selectionModel.currentIndex() == duplicate.currentIndex()); + QCOMPARE(selectionModel.currentIndex(), duplicate.currentIndex()); } void tst_QItemSelectionModel::testClearCurrentIndex() @@ -2747,13 +2747,13 @@ void tst_QItemSelectionModel::testClearCurrentIndex() QModelIndex firstIndex = model.index(0, 0); QVERIFY(firstIndex.isValid()); selectionModel.setCurrentIndex(firstIndex, QItemSelectionModel::NoUpdate); - QVERIFY(selectionModel.currentIndex() == firstIndex); - QVERIFY(currentIndexSpy.size() == 1); + QCOMPARE(selectionModel.currentIndex(), firstIndex); + QCOMPARE(currentIndexSpy.size(), 1); selectionModel.clearCurrentIndex(); - QVERIFY(selectionModel.currentIndex() == QModelIndex()); - QVERIFY(currentIndexSpy.size() == 2); + QCOMPARE(selectionModel.currentIndex(), QModelIndex()); + QCOMPARE(currentIndexSpy.size(), 2); } QTEST_MAIN(tst_QItemSelectionModel) diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 0302ae5cbf..bf8276614a 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -1663,16 +1663,16 @@ void tst_QSortFilterProxyModel::removeSourceRows() QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count()); for (int i = 0; i < aboutToRemoveSpy.count(); ++i) { QList<QVariant> args = aboutToRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } QCOMPARE(removeSpy.count(), expectedRemovedProxyIntervals.count()); for (int i = 0; i < removeSpy.count(); ++i) { QList<QVariant> args = removeSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } @@ -1841,8 +1841,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(initialInsertSpy.count(), 0); for (int i = 0; i < initialRemoveSpy.count(); ++i) { QList<QVariant> args = initialRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), initialRemoveIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), initialRemoveIntervals.at(i).second); } @@ -1864,8 +1864,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(finalRemoveSpy.count(), finalRemoveIntervals.count()); for (int i = 0; i < finalRemoveSpy.count(); ++i) { QList<QVariant> args = finalRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), finalRemoveIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), finalRemoveIntervals.at(i).second); } @@ -1876,8 +1876,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(finalInsertSpy.count(), insertIntervals.count()); for (int i = 0; i < finalInsertSpy.count(); ++i) { QList<QVariant> args = finalInsertSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), insertIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } @@ -2018,8 +2018,8 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(removeSpy.count(), removeIntervals.count()); for (int i = 0; i < removeSpy.count(); ++i) { QList<QVariant> args = removeSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), removeIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), removeIntervals.at(i).second); } @@ -2027,8 +2027,8 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(insertSpy.count(), insertIntervals.count()); for (int i = 0; i < insertSpy.count(); ++i) { QList<QVariant> args = insertSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), insertIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } @@ -3205,7 +3205,7 @@ void tst_QSortFilterProxyModel::mapSelectionFromSource() proxy.setSourceModel(&model); // Only "delta" remains. - QVERIFY(proxy.rowCount() == 1); + QCOMPARE(proxy.rowCount(), 1); QItemSelection selection; QModelIndex charlie = model.index(1, 0); @@ -3220,7 +3220,7 @@ void tst_QSortFilterProxyModel::mapSelectionFromSource() QItemSelection proxiedSelection = proxy.mapSelectionFromSource(selection); // Only "delta" is in the mapped result. - QVERIFY(proxiedSelection.size() == 1); + QCOMPARE(proxiedSelection.size(), 1); QVERIFY(isValid(proxiedSelection)); } |