diff options
Diffstat (limited to 'tests/auto/qml/qqmlenginecleanup')
9 files changed, 26 insertions, 23 deletions
diff --git a/tests/auto/qml/qqmlenginecleanup/CMakeLists.txt b/tests/auto/qml/qqmlenginecleanup/CMakeLists.txt index d91fc98f8a..87b0874774 100644 --- a/tests/auto/qml/qqmlenginecleanup/CMakeLists.txt +++ b/tests/auto/qml/qqmlenginecleanup/CMakeLists.txt @@ -7,6 +7,12 @@ ## tst_qqmlenginecleanup Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qqmlenginecleanup LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + # Collect test data file(GLOB_RECURSE test_data_glob RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml index 6dfe0d52e8..083e8f2e7c 100644 --- a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml +++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml @@ -1,5 +1,5 @@ // Copyright (C) 2019 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 import QtQml 2.12 diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp index c53f9e674b..52ab367d10 100644 --- a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp +++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 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 <QtQml/qqmlextensionplugin.h> #include <QtQml/qqmlengine.h> diff --git a/tests/auto/qml/qqmlenginecleanup/data/TestType.qml b/tests/auto/qml/qqmlenginecleanup/data/TestType.qml index 9f98ec971f..0699ac894f 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/TestType.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/TestType.qml @@ -1,5 +1,5 @@ // Copyright (C) 2016 Research In Motion. -// 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 import QtQml 2.0 QtObject{property int notJustAStandardQtObject: 10 } diff --git a/tests/auto/qml/qqmlenginecleanup/data/testFile1.qml b/tests/auto/qml/qqmlenginecleanup/data/testFile1.qml index 5298dea961..233684633f 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/testFile1.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/testFile1.qml @@ -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 import QtQuick 2.0 diff --git a/tests/auto/qml/qqmlenginecleanup/data/testFile2.qml b/tests/auto/qml/qqmlenginecleanup/data/testFile2.qml index 0bd2c54e16..02d231d375 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/testFile2.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/testFile2.qml @@ -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 import QtQuick 2.0 diff --git a/tests/auto/qml/qqmlenginecleanup/data/testFile3.qml b/tests/auto/qml/qqmlenginecleanup/data/testFile3.qml index be95e2ff74..10e2b2888a 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/testFile3.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/testFile3.qml @@ -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 import QtQuick 2.0 diff --git a/tests/auto/qml/qqmlenginecleanup/data/types.qml b/tests/auto/qml/qqmlenginecleanup/data/types.qml index f726a37404..4de1e6e43d 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/types.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/types.qml @@ -1,5 +1,5 @@ // Copyright (C) 2016 Research In Motion. -// 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 import QtQml 2.0 import QtQuick 2.0 diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp index c9049c7ca4..04e8389c87 100644 --- a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp +++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 Research In Motion. -// 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 <QtCore/QObject> #include <QtQml/qqml.h> @@ -47,8 +47,8 @@ public: void tst_qqmlenginecleanup::test_qmlClearTypeRegistrations() { //Test for preventing memory leaks is in tests/manual/qmltypememory - QQmlEngine* engine; - CleanlyLoadingComponent* component; + std::unique_ptr<QQmlEngine> engine; + std::unique_ptr<CleanlyLoadingComponent> component; QUrl testFile = testFileUrl("types.qml"); const auto qmlTypeForTestType = []() { @@ -60,12 +60,12 @@ void tst_qqmlenginecleanup::test_qmlClearTypeRegistrations() qmlRegisterType<QObject>("Test", 2, 0, "TestTypeCpp"); QVERIFY(qmlTypeForTestType().isValid()); - engine = new QQmlEngine; - component = new CleanlyLoadingComponent(engine, testFile); + engine = std::make_unique<QQmlEngine>(); + component = std::make_unique<CleanlyLoadingComponent>(engine.get(), testFile); QVERIFY(component->isReady()); - delete component; - delete engine; + component.reset(); + engine.reset(); { auto cppType = qmlTypeForTestType(); @@ -81,24 +81,21 @@ void tst_qqmlenginecleanup::test_qmlClearTypeRegistrations() //2nd run verifies that types can reload after a qmlClearTypeRegistrations qmlRegisterType<QObject>("Test", 2, 0, "TestTypeCpp"); QVERIFY(qmlTypeForTestType().isValid()); - engine = new QQmlEngine; - component = new CleanlyLoadingComponent(engine, testFile); + engine = std::make_unique<QQmlEngine>(); + component = std::make_unique<CleanlyLoadingComponent>(engine.get(), testFile); QVERIFY(component->isReady()); - delete component; - delete engine; + component.reset(); + engine.reset(); qmlClearTypeRegistrations(); QVERIFY(!qmlTypeForTestType().isValid()); //3nd run verifies that TestTypeCpp is no longer registered - engine = new QQmlEngine; - component = new CleanlyLoadingComponent(engine, testFile); + engine = std::make_unique<QQmlEngine>(); + component = std::make_unique<CleanlyLoadingComponent>(engine.get(), testFile); QVERIFY(component->isError()); QCOMPARE(component->errorString(), testFile.toString() +":8 module \"Test\" is not installed\n"); - - delete component; - delete engine; } static void cleanState(QQmlEngine **e) |