diff options
Diffstat (limited to 'tests/auto/qml/qqmlqt/tst_qqmlqt.cpp')
-rw-r--r-- | tests/auto/qml/qqmlqt/tst_qqmlqt.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 5ba1f6f848..9fea41104d 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <private/qqmlengine_p.h> @@ -27,7 +27,8 @@ #include <QTimeZone> #include <QtQuickTestUtils/private/qmlutils_p.h> -#include <private/qglobal_p.h> +#include <private/qtenvironmentvariables_p.h> // for qTzSet() +#include <private/qqmlengine_p.h> class tst_qqmlqt : public QQmlDataTest { @@ -56,8 +57,10 @@ private slots: void alpha(); void tint(); void color(); +#if QT_CONFIG(desktopservices) void openUrlExternally(); void openUrlExternally_pragmaLibrary(); +#endif void md5(); void createComponent(); void createComponent_pragmaLibrary(); @@ -612,6 +615,7 @@ public slots: void noteCall(const QUrl &url) { called++; last = url; } }; +#if QT_CONFIG(desktopservices) void tst_qqmlqt::openUrlExternally() { MyUrlHandler handler; @@ -658,6 +662,7 @@ void tst_qqmlqt::openUrlExternally_pragmaLibrary() QCOMPARE(handler.called,2); QCOMPARE(handler.last, htmlTestFile); } +#endif void tst_qqmlqt::md5() { @@ -805,7 +810,7 @@ void tst_qqmlqt::dateTimeFormatting() << component.url().toString() + ":40: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed." << component.url().toString() + ":43: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed."; - foreach (const QString &warning, warnings) + for (const QString &warning : std::as_const(warnings)) QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); warnings.clear(); @@ -820,7 +825,7 @@ void tst_qqmlqt::dateTimeFormatting() << "Could not convert argument 1 at" << "expression for err_dateTime2@"; - foreach (const QString &warning, warnings) + for (const QString &warning : std::as_const(warnings)) QTest::ignoreMessage(QtWarningMsg, QRegularExpression(warning)); QScopedPointer<QObject> object(component.createWithInitialProperties({ @@ -833,7 +838,7 @@ void tst_qqmlqt::dateTimeFormatting() QVERIFY(inputProperties.size() > 0); QVariant result; - foreach(const QString &prop, inputProperties) { + for (const QString &prop : std::as_const(inputProperties)) { QVERIFY(QMetaObject::invokeMethod(object.data(), method.toUtf8().constData(), Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, prop))); @@ -1280,12 +1285,13 @@ void tst_qqmlqt::later_data() void tst_qqmlqt::later() { + QQmlEngine engine; QFETCH(QString, function); QFETCH(QStringList, expectedWarnings); QFETCH(QStringList, propNames); QFETCH(QVariantList, values); - foreach (const QString &w, expectedWarnings) + for (const QString &w : std::as_const(expectedWarnings)) QTest::ignoreMessage(QtWarningMsg, qPrintable(w)); QQmlComponent component(&engine, testFileUrl("later.qml")); @@ -1300,7 +1306,7 @@ void tst_qqmlqt::later() QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } else if (propNames.at(i) == QLatin1String("collectGarbage")) { - engine.collectGarbage(); + gc(engine, GCFlags::DontSendPostedEvents); } else { QCOMPARE(root->property(qPrintable(propNames.at(i))), values.at(i)); } |