Tests: Use QVERIFY instead of QCOMPARE for empty lists
Pick-to: 5.15 Change-Id: I4da02fa11583eca3844bf42efcdf818b8bbd6a94 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
a83b2c64a9
commit
773a6bffd7
@ -1115,7 +1115,7 @@ void tst_QSettings::setValue()
|
||||
QCOMPARE(settings.value("key 2").toStringList(), QStringList() << "" << "a" << "" << "bc" << "");
|
||||
|
||||
settings.setValue("key 3", QList<QVariant>());
|
||||
QCOMPARE(settings.value("key 3").toList(), QList<QVariant>());
|
||||
QVERIFY(settings.value("key 3").toList().isEmpty());
|
||||
settings.setValue("key 3", QList<QVariant>() << 1 << QString("a"));
|
||||
QCOMPARE(settings.value("key 3").toList(), QList<QVariant>() << 1 << QString("a"));
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ void tst_QMetaObject::metaMethod()
|
||||
//wrong object
|
||||
//QVERIFY(!sl13.invoke(this, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QVERIFY(!sl13.invoke(0, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QCOMPARE(returnValue, QList<QString>());
|
||||
QVERIFY(returnValue.isEmpty());
|
||||
|
||||
QVERIFY(sl13.invoke(&obj, Q_RETURN_ARG(QList<QString>, returnValue), Q_ARG(QList<QString>, argument)));
|
||||
QCOMPARE(returnValue, argument);
|
||||
|
@ -797,7 +797,7 @@ void tst_QFuture::cancel()
|
||||
result = 3;
|
||||
futureInterface.reportResult(&result);
|
||||
futureInterface.reportFinished();
|
||||
QCOMPARE(f.results(), QList<int>());
|
||||
QVERIFY(f.results().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ void tst_QVersionNumber::constructorDefault()
|
||||
QCOMPARE(version.majorVersion(), 0);
|
||||
QCOMPARE(version.minorVersion(), 0);
|
||||
QCOMPARE(version.microVersion(), 0);
|
||||
QCOMPARE(version.segments(), QList<int>());
|
||||
QVERIFY(version.segments().isEmpty());
|
||||
}
|
||||
|
||||
void tst_QVersionNumber::constructorVersioned_data()
|
||||
|
@ -722,7 +722,7 @@ void tst_QStandardItemModel::data()
|
||||
currentRoles.clear();
|
||||
// bad args
|
||||
m_model->setData(QModelIndex(), "bla", Qt::DisplayRole);
|
||||
QCOMPARE(currentRoles, QList<int> {});
|
||||
QVERIFY(currentRoles.isEmpty());
|
||||
|
||||
QIcon icon;
|
||||
for (int r = 0; r < m_model->rowCount(); ++r) {
|
||||
@ -749,7 +749,7 @@ void tst_QStandardItemModel::clearItemData()
|
||||
{
|
||||
currentRoles.clear();
|
||||
QVERIFY(!m_model->clearItemData(QModelIndex()));
|
||||
QCOMPARE(currentRoles, QList<int> {});
|
||||
QVERIFY(currentRoles.isEmpty());
|
||||
const QModelIndex idx = m_model->index(0, 0);
|
||||
const QMap<int, QVariant> oldData = m_model->itemData(idx);
|
||||
m_model->setData(idx, QLatin1String("initialitem"), Qt::DisplayRole);
|
||||
@ -761,7 +761,7 @@ void tst_QStandardItemModel::clearItemData()
|
||||
QCOMPARE(idx.data(Qt::ToolTipRole), QVariant());
|
||||
QCOMPARE(idx.data(Qt::DisplayRole), QVariant());
|
||||
QCOMPARE(idx.data(Qt::EditRole), QVariant());
|
||||
QCOMPARE(currentRoles, QList<int> {});
|
||||
QVERIFY(currentRoles.isEmpty());
|
||||
m_model->setItemData(idx, oldData);
|
||||
currentRoles.clear();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ void tst_QUndoGroup::addRemoveStack()
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);
|
||||
|
||||
group.removeStack(&stack2);
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>());
|
||||
QVERIFY(group.stacks().isEmpty());
|
||||
}
|
||||
|
||||
void tst_QUndoGroup::deleteStack()
|
||||
@ -290,7 +290,7 @@ void tst_QUndoGroup::deleteStack()
|
||||
QCOMPARE(group.activeStack(), stack3);
|
||||
|
||||
group.removeStack(stack3);
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>());
|
||||
QVERIFY(group.stacks().isEmpty());
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
|
||||
delete stack3;
|
||||
|
@ -2882,8 +2882,8 @@ void tst_QAccessibility::listTest()
|
||||
QCOMPARE(cellInterface->columnIndex(), 0);
|
||||
QCOMPARE(cellInterface->rowExtent(), 1);
|
||||
QCOMPARE(cellInterface->columnExtent(), 1);
|
||||
QCOMPARE(cellInterface->rowHeaderCells(), QList<QAccessibleInterface*>());
|
||||
QCOMPARE(cellInterface->columnHeaderCells(), QList<QAccessibleInterface*>());
|
||||
QVERIFY(cellInterface->rowHeaderCells().isEmpty());
|
||||
QVERIFY(cellInterface->columnHeaderCells().isEmpty());
|
||||
|
||||
QCOMPARE(cellInterface->table()->object(), listView);
|
||||
|
||||
|
@ -944,7 +944,7 @@ void tst_QGraphicsView::rubberBandSelectionMode()
|
||||
// terminate the rubber band.
|
||||
view.viewport()->setMouseTracking(false);
|
||||
|
||||
QCOMPARE(scene.selectedItems(), QList<QGraphicsItem *>());
|
||||
QVERIFY(scene.selectedItems().isEmpty());
|
||||
sendMousePress(view.viewport(), QPoint(), Qt::LeftButton);
|
||||
sendMouseMove(view.viewport(), view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton);
|
||||
@ -954,10 +954,10 @@ void tst_QGraphicsView::rubberBandSelectionMode()
|
||||
view.setRubberBandSelectionMode(Qt::ContainsItemShape);
|
||||
QCOMPARE(view.rubberBandSelectionMode(), Qt::ContainsItemShape);
|
||||
sendMousePress(view.viewport(), QPoint(), Qt::LeftButton);
|
||||
QCOMPARE(scene.selectedItems(), QList<QGraphicsItem *>());
|
||||
QVERIFY(scene.selectedItems().isEmpty());
|
||||
sendMouseMove(view.viewport(), view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton);
|
||||
QCOMPARE(scene.selectedItems(), QList<QGraphicsItem *>());
|
||||
QVERIFY(scene.selectedItems().isEmpty());
|
||||
sendMouseMove(view.viewport(), view.viewport()->rect().bottomRight(),
|
||||
Qt::LeftButton, Qt::LeftButton);
|
||||
QCOMPARE(scene.selectedItems(), QList<QGraphicsItem *>() << rect);
|
||||
@ -1049,7 +1049,7 @@ void tst_QGraphicsView::rotated_rubberBand()
|
||||
// terminate the rubber band.
|
||||
view.viewport()->setMouseTracking(false);
|
||||
|
||||
QCOMPARE(scene.selectedItems(), QList<QGraphicsItem *>());
|
||||
QVERIFY(scene.selectedItems().isEmpty());
|
||||
int midWidth = view.viewport()->width() / 2;
|
||||
sendMousePress(view.viewport(), QPoint(midWidth - 2, 0), Qt::LeftButton);
|
||||
sendMouseMove(view.viewport(), QPoint(midWidth + 2, view.viewport()->height()),
|
||||
|
Loading…
Reference in New Issue
Block a user