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/qqmlengine | |
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/qqmlengine')
-rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index e6a87bb51f..9e35286b4b 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.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 <QQmlEngine> #include <QQmlContext> #include <QNetworkAccessManager> @@ -495,22 +493,25 @@ void tst_qqmlengine::trimComponentCache_data() // empty apart from their inherited elements, and those that define new properties. // For each there are five types of composition: extension, aggregation, // aggregation via component, property and object-created-via-transient-component. - foreach (const QString &test, (QStringList() << "EmptyComponent" - << "VMEComponent" - << "EmptyExtendEmptyComponent" - << "VMEExtendEmptyComponent" - << "EmptyExtendVMEComponent" - << "VMEExtendVMEComponent" - << "EmptyAggregateEmptyComponent" - << "VMEAggregateEmptyComponent" - << "EmptyAggregateVMEComponent" - << "VMEAggregateVMEComponent" - << "EmptyPropertyEmptyComponent" - << "VMEPropertyEmptyComponent" - << "EmptyPropertyVMEComponent" - << "VMEPropertyVMEComponent" - << "VMETransientEmptyComponent" - << "VMETransientVMEComponent")) { + const QStringList components = { + "EmptyComponent", + "VMEComponent", + "EmptyExtendEmptyComponent", + "VMEExtendEmptyComponent", + "EmptyExtendVMEComponent", + "VMEExtendVMEComponent", + "EmptyAggregateEmptyComponent", + "VMEAggregateEmptyComponent", + "EmptyAggregateVMEComponent", + "VMEAggregateVMEComponent", + "EmptyPropertyEmptyComponent", + "VMEPropertyEmptyComponent", + "EmptyPropertyVMEComponent", + "VMEPropertyVMEComponent", + "VMETransientEmptyComponent", + "VMETransientVMEComponent", + }; + for (const QString &test : components) { // For these cases, we first test that the component instance keeps the components // referenced, and then that the instantiated object keeps the components referenced for (int i = 1; i <= 2; ++i) { @@ -902,7 +903,7 @@ void tst_qqmlengine::qtqmlModule() QFETCH(QString, expectedError); QFETCH(QStringList, expectedWarnings); - foreach (const QString &w, expectedWarnings) + for (const QString &w : std::as_const(expectedWarnings)) QTest::ignoreMessage(QtWarningMsg, qPrintable(w)); QQmlEngine e; |