From c3bd0911f5b5d6a878c7fbcf2c0095ced703a237 Mon Sep 17 00:00:00 2001 From: Sami Shalayel Date: Thu, 22 Dec 2022 17:24:16 +0100 Subject: make tst_qmltc::namespacedName() test something Fix the tst_qmltc::namespacedName() test and check if the type really can be used, instead of just checking if the type is there. Now that the type is really used, fix the arising assertion by adding the missing CMake dependency. Change-Id: I283af9cba37fbe90d2d2c76e1be7e1801b613a77 Reviewed-by: Fabian Kosmale Reviewed-by: Ulf Hermann --- tests/auto/qml/qmltc/CMakeLists.txt | 1 + tests/auto/qml/qmltc/NamespaceTest/Subfolder/Type.qml | 2 +- tests/auto/qml/qmltc/tst_qmltc.cpp | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auto/qml/qmltc/CMakeLists.txt b/tests/auto/qml/qmltc/CMakeLists.txt index 1b7fbf6ee1..3aee154aeb 100644 --- a/tests/auto/qml/qmltc/CMakeLists.txt +++ b/tests/auto/qml/qmltc/CMakeLists.txt @@ -19,6 +19,7 @@ set(qmltc_module_libs # automatic type registration that comes from the plugin) qmltc_test_moduleplugin qmltc_namespace_test_module + qmltc_namespace_test_moduleplugin qmltc_exported_tests_module qmltc_exported_tests_moduleplugin ) diff --git a/tests/auto/qml/qmltc/NamespaceTest/Subfolder/Type.qml b/tests/auto/qml/qmltc/NamespaceTest/Subfolder/Type.qml index 101e9f69a1..3576353b02 100644 --- a/tests/auto/qml/qmltc/NamespaceTest/Subfolder/Type.qml +++ b/tests/auto/qml/qmltc/NamespaceTest/Subfolder/Type.qml @@ -1,5 +1,5 @@ import QtQuick Item { - property string data + property string data: "Hello from namespace" } diff --git a/tests/auto/qml/qmltc/tst_qmltc.cpp b/tests/auto/qml/qmltc/tst_qmltc.cpp index 381701991e..a704da4fe7 100644 --- a/tests/auto/qml/qmltc/tst_qmltc.cpp +++ b/tests/auto/qml/qmltc/tst_qmltc.cpp @@ -3205,8 +3205,9 @@ void tst_qmltc::namespacedName() { // cmake script should be able to auto-fill the namespace of the generated modules, and to // replace . with :: - NamespaceTest::Subfolder::Type *t; - Q_UNUSED(t); + QQmlEngine e; + NamespaceTest::Subfolder::Type t(&e); + QCOMPARE(t.data(), u"Hello from namespace"_s); } void tst_qmltc::checkExportsAreCompiling() -- cgit v1.2.3