aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-22 12:33:52 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-22 16:00:22 +0200
commit1270a88cb3fa446ce2201d4204ff05b8b969f2ea (patch)
treeaa14ad6fc6cb3eb2740a7803c598a8297ac36be1 /tests
parent328759cdeb7b45eba5569b54ded35e38152ee0d0 (diff)
Fix compile warnings from tests
Use streaming operators for debug/warnings to avoid qsizehint/int conflicts. Don't ignore return values from [[no_discard]] functions. Don't copy elements from containers that return references. Remove unused variables. Change-Id: I7a0bef94a5e828bd8facee0c625ec48c3d1f1bdb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp5
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp3
-rw-r--r--tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp4
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp10
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp4
6 files changed, 13 insertions, 15 deletions
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
index add19273d9..4718eb33b4 100644
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
@@ -610,9 +610,8 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec
}
}
- qDebug("\n"
- "expected (count == %d): %s\n"
- "actual (count == %d): %s\n", expectedStates.count(), qPrintable(e), spy.count(), qPrintable(a));
+ qDebug().noquote() << "\nexpected (count == " << expectedStates.count() << "): " << e
+ << "\nactual (count == " << spy.count() << "): " << a << "\n";
}
return equals;
}
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 92a5787bdb..c947f050ba 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -259,9 +259,6 @@ void tst_qqmlmetatype::isList()
{
QCOMPARE(QQmlMetaType::isList(QMetaType::UnknownType), false);
QCOMPARE(QQmlMetaType::isList(QMetaType::Int), false);
-
- QQmlListProperty<TestType> list;
-
QCOMPARE(QQmlMetaType::isList(qMetaTypeId<QQmlListProperty<TestType> >()), true);
}
diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
index d4b65e1222..73cdba5f8c 100644
--- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
+++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
@@ -68,7 +68,7 @@ void tst_qqmltranslation::translation()
QFETCH(bool, verifyCompiledData);
QTranslator translator;
- translator.load(translation, dataDirectory());
+ QVERIFY(translator.load(translation, dataDirectory()));
QCoreApplication::installTranslator(&translator);
QQmlEngine engine;
@@ -128,7 +128,7 @@ void tst_qqmltranslation::translation()
void tst_qqmltranslation::idTranslation()
{
QTranslator translator;
- translator.load(QLatin1String("qmlid_fr"), dataDirectory());
+ QVERIFY(translator.load(QLatin1String("qmlid_fr"), dataDirectory()));
QCoreApplication::installTranslator(&translator);
QQmlEngine engine;
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 2d7c374419..cde228f6c4 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -117,11 +117,13 @@ void tst_QQuickAccessible::cleanup()
{
const EventList list = QTestAccessibility::events();
if (!list.isEmpty()) {
- qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
- QString(QTest::currentTestFunction()).toLatin1().constData());
+ qWarning().noquote() << list.count()
+ << "accessibility event(s) were not handled in testfunction '"
+ << QTest::currentTestFunction() << "':";
for (int i = 0; i < list.count(); ++i)
- qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(),
- qAccessibleEventString(list.at(i)->type()), list.at(i)->child());
+ qWarning().noquote() << " " << (i + 1) << ": Object: " << list.at(i)->object()
+ << "Event: '" << qAccessibleEventString(list.at(i)->type())
+ << "' Child: " << list.at(i)->child();
}
QTestAccessibility::clearEvents();
}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 9aed54b487..6c7c84c0cf 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -792,7 +792,7 @@ void tst_qquickflickable::resizeContent()
QSizeChangeListener sizeListener(fp->contentItem);
QMetaObject::invokeMethod(root, "resizeContent");
- for (const QSize sizeOnGeometryChanged : sizeListener) {
+ for (const QSize &sizeOnGeometryChanged : sizeListener) {
// Check that we have the correct size on all signals
QCOMPARE(sizeOnGeometryChanged, QSize(600, 600));
}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 51a753c199..00cd06f3ae 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -5489,9 +5489,9 @@ void tst_QQuickListView::headerSnapToItem()
QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, startPos, 200); // Wait 200 ms before we release to avoid trigger a flick
// wait for the "fixup" animation to finish
- QTest::qWaitFor([&]()
+ QVERIFY(QTest::qWaitFor([&]()
{ return !listview->isMoving();}
- );
+ ));
QCOMPARE(listview->contentPosition(), expectedContentPosition);
QCOMPARE(listview->headerPosition(), expectedHeaderPosition);