diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-08-07 10:20:42 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-08-22 20:11:34 +0200 |
commit | d3c05159510efd7862ef8c8bfc9b0adc3963a25b (patch) | |
tree | 4e8f66f441ae99d6935b6b4c0ba2ed38702b1225 /tests/auto/qml/qqmlmoduleplugin | |
parent | 1d3385e9887e912a79835c7defc878edf4ab7ec5 (diff) |
Remove remaining foreach in qml tests
Task-number: QTBUG-115808
Change-Id: If02f3cbb97e8a6035544d10ee2c23f5c87ed618c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin')
-rw-r--r-- | tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 40c7973b06..8b3b91c060 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include <qtest.h> #include <qdir.h> #include <QtQml/qqmlengine.h> @@ -210,7 +208,8 @@ void tst_qqmlmoduleplugin::importsPlugin() QTest::ignoreMessage(QtWarningMsg, qPrintable(QString("import%1 worked").arg(suffix))); QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(qmlFile)); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); std::unique_ptr<QObject> object { component.create() }; @@ -284,7 +283,8 @@ void tst_qqmlmoduleplugin::importPluginWithQmlFile() QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestPluginWithQmlFile' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(QStringLiteral("pluginWithQmlFile.qml"))); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); std::unique_ptr<QObject> object { component.create() }; @@ -305,7 +305,8 @@ void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl() QCOMPARE(object->property("width").toInt(), 300); QVERIFY(object.get() != nullptr); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); } @@ -327,7 +328,8 @@ void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri() QVERIFY(object.get() != nullptr); QCOMPARE(object->property("width").toInt(), 300); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); } @@ -680,7 +682,8 @@ void tst_qqmlmoduleplugin::importsChildPlugin() QTest::ignoreMessage(QtWarningMsg, "child import worked"); QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(QStringLiteral("child.qml"))); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); std::unique_ptr<QObject> object { component.create() }; @@ -696,7 +699,8 @@ void tst_qqmlmoduleplugin::importsChildPlugin2() QTest::ignoreMessage(QtWarningMsg, "child import2 worked"); QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(QStringLiteral("child2.qml"))); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); std::unique_ptr<QObject> object { component.create() }; @@ -712,7 +716,8 @@ void tst_qqmlmoduleplugin::importsChildPlugin21() QTest::ignoreMessage(QtWarningMsg, "child import2.1 worked"); QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(QStringLiteral("child21.qml"))); - foreach (QQmlError err, component.errors()) + const auto errors = component.errors(); + for (const QQmlError &err : errors) qWarning() << err; VERIFY_ERRORS(0); std::unique_ptr<QObject> object { component.create() }; |