aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlpropertymap
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlpropertymap')
-rw-r--r--tests/auto/qml/qqmlpropertymap/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp29
2 files changed, 16 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmlpropertymap/CMakeLists.txt b/tests/auto/qml/qqmlpropertymap/CMakeLists.txt
index bb314ba006..2a7bd742fa 100644
--- a/tests/auto/qml/qqmlpropertymap/CMakeLists.txt
+++ b/tests/auto/qml/qqmlpropertymap/CMakeLists.txt
@@ -7,6 +7,12 @@
## tst_qqmlpropertymap Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qqmlpropertymap 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/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 689202346c..2d91a8502d 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.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 <qtest.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
#include <QtQml/qqmlengine.h>
@@ -346,9 +346,8 @@ void tst_QQmlPropertyMap::controlledWrite()
component.setData(qmlSource, QUrl::fromLocalFile(""));
QVERIFY(component.isReady());
- QObject *obj = component.create();
- QVERIFY(obj);
- delete obj;
+ std::unique_ptr<QObject> obj { component.create() };
+ QVERIFY(obj.get());
QCOMPARE(map.value(QLatin1String("key1")), QVariant("HELLO WORLD"));
QCOMPARE(map.value(QLatin1String("key2")), QVariant("Goodbye"));
@@ -364,8 +363,7 @@ void tst_QQmlPropertyMap::crashBug()
QQmlComponent c(&engine);
c.setData("import QtQuick 2.0\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl());
- QObject *obj = c.create(&context);
- delete obj;
+ std::unique_ptr<QObject> obj { c.create(&context) };
}
void tst_QQmlPropertyMap::QTBUG_17868()
@@ -378,10 +376,9 @@ void tst_QQmlPropertyMap::QTBUG_17868()
map.insert("key", 1);
QQmlComponent c(&engine);
c.setData("import QtQuick 2.0\nItem {property bool error:false; Component.onCompleted: {try{ map.keys(); }catch(e) {error=true;}}}",QUrl());
- QObject *obj = c.create(&context);
- QVERIFY(obj);
+ std::unique_ptr<QObject> obj { c.create(&context) };
+ QVERIFY(obj.get());
QVERIFY(!obj->property("error").toBool());
- delete obj;
}
@@ -434,17 +431,14 @@ void tst_QQmlPropertyMap::QTBUG_31226()
" Timer { interval: 5; running: true; onTriggered: { myProp = qmlPropertyMap.greeting; } }\n"
"}",
QUrl());
- QObject *obj = c.create(&context);
- QVERIFY(obj);
+ std::unique_ptr<QObject> obj { c.create(&context) };
+ QVERIFY(obj.get());
QQmlPropertyMap *qmlPropertyMap = obj->findChild<QQmlPropertyMap*>(QString("qmlPropertyMap"));
QVERIFY(qmlPropertyMap);
qmlPropertyMap->insert("greeting", QString("Hello world!"));
QTRY_COMPARE(obj->property("myProp").toString(), QString("Hello world!"));
-
- delete obj;
-
}
void tst_QQmlPropertyMap::QTBUG_29836()
@@ -461,13 +455,10 @@ void tst_QQmlPropertyMap::QTBUG_29836()
" Timer { interval: 5; running: true; onTriggered: enhancedMap.testSlot() }\n"
"}",
QUrl());
- QObject *obj = c.create(&context);
- QVERIFY(obj);
+ std::unique_ptr<QObject> obj { c.create(&context) };
+ QVERIFY(obj.get());
QTRY_COMPARE(map.testSlotCalled(), true);
-
- delete obj;
-
}
void tst_QQmlPropertyMap::QTBUG_35233()