aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-11-02 12:42:33 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-11-02 14:56:12 +0100
commit66c8e1f6851b35bb3f9063db377d6cbb2856a941 (patch)
tree04fb905e2a92c6d5ece1d280ba954b3457c2f146 /tests
parente47edfe7a75eb9240604e66fc6a400ebef83b6a0 (diff)
Fix compiler warnings from tests
Replace foreach with ranged for; don't name unused function parameters. Change-Id: If0d9138261567edb14b72791799c6da1b16b5a5b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h4
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index da2a9ba130..dead289b15 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1744,8 +1744,8 @@ public:
QString funcCalled;
public slots:
QPersistentModelIndex getIndex() const { return QPersistentModelIndex(QModelIndex()); }
- void selection(const QModelIndex &mi, int n = 0) { funcCalled = QLatin1String("QModelIndex"); }
- void selection(const QItemSelection &is, int n = 0) { funcCalled = QLatin1String("QItemSelection"); }
+ void selection(const QModelIndex &, int = 0) { funcCalled = QLatin1String("QModelIndex"); }
+ void selection(const QItemSelection &, int = 0) { funcCalled = QLatin1String("QItemSelection"); }
};
struct ClassWithQProperty2 : public QObject
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index dd662ef6d3..8778a1e1ac 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4205,9 +4205,8 @@ void tst_qqmlecmascript::singletonType()
if (!errorMessage.isEmpty())
QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData());
- if (warningMessages.size())
- foreach (const QString &warning, warningMessages)
- QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ for (const QString &warning : qAsConst(warningMessages))
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
QObject *object = component.create();
if (!errorMessage.isEmpty()) {
@@ -4566,9 +4565,10 @@ void tst_qqmlecmascript::importScripts()
if (!errorMessage.isEmpty())
QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData());
- if (compilationShouldSucceed && warningMessages.size())
- foreach (const QString &warning, warningMessages)
+ if (compilationShouldSucceed) {
+ for (const QString &warning : qAsConst(warningMessages))
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ }
if (compilationShouldSucceed)
QTRY_VERIFY(component.isReady());