aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitrii Akshintsev <dmitrii.akshintsev@qt.io>2025-03-05 13:17:09 +0100
committerDmitrii Akshintsev <dmitrii.akshintsev@qt.io>2025-03-18 11:28:27 +0100
commit30f030d03d5f8199757d5f4fb3bacbd7408204cc (patch)
tree6f74e9e875a3ec1bf4ff2eaea896c12f1422dd7e
parentf469d538a71a500a2b2cec6133065b780c3a8792 (diff)
qtdeclarative: fix tst_qqmlmoduleplugin when statically built
This test was written before the qt_add_qml_module, plugins were manually written with a help of a deprecated QQmlExtensionPlugin. Assuming that plugins are, by nature, dynamic objects to be loaded at a runtime, this test was not intended to cover cases when plugins are statically built and linked into the test. The fix consists of the following: 1. Introduction of conditional macro definition QT_STATICPLUGIN for static builds. Based on this macro, MOC in it's turn, generates qt_static_plugin_##PLUGIN() symbols 2. Preventing symbol clashes (ODR violation) in static builds by renaming Plugin and type names. 3. Preventing linker optimizations by explicitly referencing MOC-generated qt_static_plugin_##PLUGIN symbols through Q_IMPORT_QML_PLUGIN. 4. Making static plugins "findable" by Pluginimporter by passing uri as a moc option 5. Minor refactoring of the tests: a) make "non-strict clash" test isolated (not relying on the previous state of execution) b) unite importsPlugin and importsChildPlugin More context on the "-Muri" MOC option e8c4af1ac5429dba8062dbe7702746af96e8fdef 0d4f698c80e5e63f790771a369aa6a1fa987c41e Fixes: QTBUG-131812 Pick-to: 6.8 6.9 Change-Id: I6582c393182b80aeb1f01c1fa93417e1d4f316c9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--tests/auto/qml/CMakeLists.txt7
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt15
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp12
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp11
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp17
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.2/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp17
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp17
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp7
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp11
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp15
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule.2/CMakeLists.txt6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp11
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/CMakeLists.txt11
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp11
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp137
42 files changed, 266 insertions, 216 deletions
diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt
index 50e6a2f1ca..1fb448d4ad 100644
--- a/tests/auto/qml/CMakeLists.txt
+++ b/tests/auto/qml/CMakeLists.txt
@@ -22,6 +22,10 @@ if(NOT INTEGRITY)
add_subdirectory(common)
endif()
+if(NOT ANDROID) # QTBUG-100003
+ add_subdirectory(qqmlmoduleplugin)
+endif()
+
# Limit set of tests to run for static Qt builds.
if(QT_BUILD_MINIMAL_STATIC_TESTS)
return()
@@ -38,9 +42,6 @@ if(QT_FEATURE_qml_locale)
add_subdirectory(qqmllocale)
endif()
add_subdirectory(qqmlmetaobject)
-if(NOT ANDROID) # QTBUG-100003
- add_subdirectory(qqmlmoduleplugin)
-endif()
add_subdirectory(qqmlnotifier)
add_subdirectory(qqmlqt)
add_subdirectory(qqmlxmlhttprequest)
diff --git a/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt
index 0ae711610c..3d94b67bcf 100644
--- a/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt
@@ -106,6 +106,7 @@ qt_internal_extend_target(tst_qqmlmoduleplugin CONDITION NOT ANDROID AND NOT IOS
DEFINES
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
)
+
add_subdirectory(plugin)
add_subdirectory(plugin.2)
add_subdirectory(plugin.2.1)
@@ -128,3 +129,17 @@ add_subdirectory(plugin.2.1/childplugin)
add_subdirectory(plugin.2.2)
add_subdirectory(moduleWithQmlSingleton)
add_subdirectory(optionalPlugin)
+
+add_dependencies(tst_qqmlmoduleplugin plugin plugin.2 plugin.2.1 plugin.2.2
+ pluginMixed pluginWrongCase pluginWithQmlFile pluginVersion nestedPlugin
+ strictModule strictModule.2 nonstrictModule preemptiveModule preemptedStrictModule
+ invalidNamespaceModule invalidFirstCommandModule childplugin childplugin.2 childplugin.2.1
+ moduleWithQmlSingleton)
+
+if(NOT BUILD_SHARED_LIBS)
+ target_link_libraries(tst_qqmlmoduleplugin PRIVATE plugin plugin.2 plugin.2.1 plugin.2.2
+ pluginMixed Qt6::qtquick2plugin pluginWithQmlFile pluginVersion nestedPlugin
+ strictModule strictModule.2 nonstrictModule preemptiveModule preemptedStrictModule
+ invalidNamespaceModule invalidFirstCommandModule childplugin childplugin.2 childplugin.2.1
+ moduleWithQmlSingleton)
+endif()
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/CMakeLists.txt
index d174483c09..aeee7afdb4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(invalidFirstCommandModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/InvalidFirstCommandModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.InvalidFirstCommandModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(invalidFirstCommandModule
Qt::QmlPrivate
)
+get_target_property(target_type invalidFirstCommandModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(invalidFirstCommandModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:invalidFirstCommandModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
index c60161f424..bb9fbdddc4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
@@ -5,26 +5,22 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeInvalidFirstCommand : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginInvalidFirstCommand : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidFirstCommandModule");
- qmlRegisterType<MyPluginType>("org.qtproject.InvalidFirstCommandModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeInvalidFirstCommand>("org.qtproject.InvalidFirstCommandModule",
+ 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/CMakeLists.txt
index 3074a7c7fd..74a23e6609 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(invalidNamespaceModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/InvalidNamespaceModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.InvalidNamespaceModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(invalidNamespaceModule
Qt::QmlPrivate
)
+get_target_property(target_type invalidNamespaceModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(invalidNamespaceModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:invalidNamespaceModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
index 000a75375f..cbaf2d4cb3 100644
--- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
@@ -5,26 +5,22 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeInvalidNamespace : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginInvalidNamespace : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
- Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidStrictModule");
- qmlRegisterType<MyPluginType>("org.qtproject.SomeOtherModule", 1, 0, "MyPluginType");
+ Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidNamespaceModule");
+ qmlRegisterType<MyPluginTypeInvalidNamespace>("org.qtproject.SomeOtherModule", 1, 0,
+ "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/CMakeLists.txt
index 7c11cc392e..f52b697338 100644
--- a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(moduleWithQmlSingleton
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/ModuleWithQmlSingleton"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.ModuleWithQmlSingleton"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(moduleWithQmlSingleton
Qt::QmlPrivate
)
+get_target_property(target_type moduleWithQmlSingleton TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(moduleWithQmlSingleton PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:moduleWithQmlSingleton.pro:<TRUE>:
# COPIES = "importfiles" "subfiles"
# IMPORT_FILES = "qmldir" "MySingleton.qml" "MySingleton2.qml"
diff --git a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/plugin.cpp
index 5ffd28dcbb..80a4873b7a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/plugin.cpp
@@ -6,14 +6,12 @@
#include <QDir>
#include <QDebug>
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginSingleton : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.ModuleWithQmlSingleton");
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/CMakeLists.txt
index f6db62875c..21a485eb61 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(nestedPlugin
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlNestedPluginType"
SOURCES
nestedPlugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlNestedPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(nestedPlugin
Qt::QmlPrivate
)
+get_target_property(target_type nestedPlugin TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(nestedPlugin PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:nestedPlugin.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
index 858b2b4704..9bddf0f0c4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
@@ -5,14 +5,12 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeNested : public QObject
{
Q_OBJECT
Q_PROPERTY(QString value READ value)
public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
-
QString value() const { return "Hello"; }
};
@@ -22,24 +20,19 @@ class MyNestedPluginType : public QObject
Q_PROPERTY(QString value READ value)
public:
- MyNestedPluginType(QObject *parent=nullptr) : QObject(parent) {}
-
QString value() const { return "Goodbye"; }
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginNested : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlNestedPluginType");
- qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeNested>(uri, 1, 0, "MyPluginType");
QString nestedUri(uri);
nestedUri += QLatin1String(".Nested");
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/CMakeLists.txt
index 4059e009f8..58616186fd 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(nonstrictModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/NonstrictModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.NonstrictModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(nonstrictModule
Qt::QmlPrivate
)
+get_target_property(target_type nonstrictModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(nonstrictModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:nonstrictModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
index 00be65b599..2edf436de7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
@@ -5,28 +5,23 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeNonStrict : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginNonStrict : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.NonstrictModule");
// Install into a namespace that should be protected
- qmlRegisterType<MyPluginType>("org.qtproject.StrictModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeNonStrict>("org.qtproject.StrictModule", 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/CMakeLists.txt
index 8a9eab85d7..bbfcf15931 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(plugin.2.1
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlPluginType.2.1"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(plugin.2.1
Qt::QmlPrivate
)
+get_target_property(target_type plugin.2.1 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(plugin.2.1 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:plugin.2.1.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/CMakeLists.txt
index eb35676766..f4ab8c4b70 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(childplugin.2.1 # special case
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../imports/org/qtproject/AutoTestQmlPluginType.2.1/ChildPlugin"
SOURCES
childplugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType.ChildPlugin"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(childplugin.2.1 # special case
Qt::QmlPrivate
)
+get_target_property(target_type childplugin.2.1 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(childplugin.2.1 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:childplugin.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp
index 7061c5a8c1..229cc5f3b3 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp
@@ -5,14 +5,14 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyChildPluginType : public QObject
+class MyChildPluginTypeV2_1 : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
public:
- MyChildPluginType(QObject *parent=nullptr) : QObject(parent)
+ MyChildPluginTypeV2_1(QObject *parent = nullptr) : QObject(parent)
{
qWarning("child import2.1 worked");
}
@@ -24,22 +24,18 @@ private:
int v;
};
-
-class MyChildPlugin : public QQmlExtensionPlugin
+class MyChildPluginV2_1 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyChildPlugin()
- {
- qWarning("child plugin2.1 created");
- }
+ MyChildPluginV2_1() { qWarning("child plugin2.1 created"); }
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType.ChildPlugin");
- qmlRegisterType<MyChildPluginType>(uri, 2, 1, "MyChildPluginType");
+ qmlRegisterType<MyChildPluginTypeV2_1>(uri, 2, 1, "MyChildPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
index 0ca3603267..302b1b967a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
@@ -5,17 +5,14 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeV2_1 : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent)
- {
- qWarning("import2.1 worked");
- }
+ MyPluginTypeV2_1(QObject *parent = nullptr) : QObject(parent) { qWarning("import2.1 worked"); }
int value() const { return v; }
void setValue(int i) { v = i; }
@@ -24,22 +21,18 @@ private:
int v;
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginV2_1 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin()
- {
- qWarning("plugin2.1 created");
- }
+ MyPluginV2_1() { qWarning("plugin2.1 created"); }
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
- qmlRegisterType<MyPluginType>(uri, 2, 1, "MyPluginType");
+ qmlRegisterType<MyPluginTypeV2_1>(uri, 2, 1, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/CMakeLists.txt
index e143445953..274630a046 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(plugin.2.2
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlPluginType.2.2"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(plugin.2.2
Qt::QmlPrivate
)
+get_target_property(target_type plugin.2.2 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(plugin.2.2 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:plugin.2.2.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp
index c97824112e..eb405720fb 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp
@@ -5,17 +5,14 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeV2_2 : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent)
- {
- qWarning("import2.2 worked");
- }
+ MyPluginTypeV2_2(QObject *parent = nullptr) : QObject(parent) { qWarning("import2.2 worked"); }
int value() const { return v; }
void setValue(int i) { v = i; }
@@ -24,22 +21,18 @@ private:
int v;
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginV2_2 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin()
- {
- qWarning("plugin2.2 created");
- }
+ MyPluginV2_2() { qWarning("plugin2.2 created"); }
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
- qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeV2_2>(uri, 2, 2, "MyPluginType");
qmlRegisterModule(uri, 2, 2);
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin.2/CMakeLists.txt
index 5e40a2d9fe..ef2b53f125 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(plugin.2
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlPluginType.2"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(plugin.2
Qt::QmlPrivate
)
+get_target_property(target_type plugin.2 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(plugin.2 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:plugin.2.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/CMakeLists.txt
index 3af88b4b63..d3b1e2adc2 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(childplugin.2 # special case
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../imports/org/qtproject/AutoTestQmlPluginType.2/ChildPlugin"
SOURCES
childplugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType.ChildPlugin"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(childplugin.2 # special case
Qt::QmlPrivate
)
+get_target_property(target_type childplugin.2 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(childplugin.2 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:childplugin.pro:<TRUE>:
# IMPORT_DIR = "DESTDIR"
# IMPORT_FILES = "qmldir"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp
index 1ac6e8902f..371310905a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp
@@ -5,14 +5,14 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyChildPluginType : public QObject
+class MyChildPluginTypeV2 : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
public:
- MyChildPluginType(QObject *parent=nullptr) : QObject(parent)
+ MyChildPluginTypeV2(QObject *parent = nullptr) : QObject(parent)
{
qWarning("child import2 worked");
}
@@ -24,22 +24,18 @@ private:
int v;
};
-
-class MyChildPlugin : public QQmlExtensionPlugin
+class MyChildPluginV2 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyChildPlugin()
- {
- qWarning("child plugin2 created");
- }
+ MyChildPluginV2() { qWarning("child plugin2 created"); }
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType.ChildPlugin");
- qmlRegisterType<MyChildPluginType>(uri, 2, 0, "MyChildPluginType");
+ qmlRegisterType<MyChildPluginTypeV2>(uri, 2, 0, "MyChildPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
index 4dbc3c15bb..117b34e0cb 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
@@ -5,17 +5,14 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeV2 : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value WRITE setValue)
Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent)
- {
- qWarning("import2 worked");
- }
+ MyPluginTypeV2(QObject *parent = nullptr) : QObject(parent) { qWarning("import2 worked"); }
int value() const { return v; }
void setValue(int i) { v = i; }
@@ -24,22 +21,18 @@ private:
int v;
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginV2 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin()
- {
- qWarning("plugin2 created");
- }
+ MyPluginV2() { qWarning("plugin2 created"); }
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType");
- qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeV2>(uri, 2, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin/CMakeLists.txt
index 8e5f0449d7..71a7dc08f7 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(plugin
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlPluginType"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(plugin
Qt::QmlPrivate
)
+get_target_property(target_type plugin TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(plugin PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/CMakeLists.txt
index 664ba7ea98..76a443412f 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(childplugin
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../imports/org/qtproject/AutoTestQmlPluginType/ChildPlugin"
SOURCES
childplugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlPluginType.ChildPlugin"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(childplugin
Qt::QmlPrivate
)
+get_target_property(target_type childplugin TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(childplugin PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:childplugin.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp
index 3e5ae31d62..99368e8575 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp
@@ -30,10 +30,7 @@ class MyChildPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyChildPlugin()
- {
- qWarning("child plugin created");
- }
+ MyChildPlugin() { qWarning("child plugin created"); }
void registerTypes(const char *uri) override
{
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
index dcf9ed676a..d1a64b260b 100644
--- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
@@ -23,7 +23,6 @@ private:
int v;
};
-
class MyPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/CMakeLists.txt
index 82c6ac4338..8dba034ec8 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(pluginMixed
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlMixedPluginType"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlMixedPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(pluginMixed
Qt::QmlPrivate
)
+get_target_property(target_type pluginMixed TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(pluginMixed PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:pluginMixed.pro:<TRUE>:
# IMPORT_FILES = "Foo.qml" "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
index 84b795d165..30a42faaa3 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
@@ -21,10 +21,6 @@ class MyMixedPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyMixedPlugin()
- {
- }
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlMixedPluginType");
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/CMakeLists.txt
index 4afc872f7a..fb109371ea 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(pluginVersion
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestQmlVersionPluginType"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestQmlVersionPluginType"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(pluginVersion
Qt::QmlPrivate
)
+get_target_property(target_type pluginVersion TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(pluginVersion PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:pluginVersion.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
index 26d9977f7d..baddfd6610 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
@@ -14,17 +14,12 @@ public:
int value() const { return 16; }
};
-
-class MyMixedPlugin : public QQmlExtensionPlugin
+class MyMixedPluginVersion : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyMixedPlugin()
- {
- }
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlVersionPluginType");
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/CMakeLists.txt
index 4cac801ff6..abc9134896 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(pluginWithQmlFile
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/AutoTestPluginWithQmlFile"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.AutoTestPluginWithQmlFile"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(pluginWithQmlFile
Qt::QmlPrivate
)
+get_target_property(target_type pluginWithQmlFile TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(pluginWithQmlFile PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:pluginWithQmlFile.pro:<TRUE>:
# IMPORT_FILES = "qmldir" "MyQmlFile.qml"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
index c8620cbe5e..e2f2fb6329 100644
--- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
@@ -5,7 +5,7 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginWithQml : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/CMakeLists.txt
index 6a4d6de011..28403e810a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(preemptedStrictModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/PreemptedStrictModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.PreemptedStrictModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(preemptedStrictModule
Qt::QmlPrivate
)
+get_target_property(target_type preemptedStrictModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(preemptedStrictModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:preemptedStrictModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
index 40eebfe3bb..ea448f2034 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
@@ -5,26 +5,21 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypePreemptedStrict : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginPreemptedStrict : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.PreemptedStrictModule");
- qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypePreemptedStrict>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/CMakeLists.txt
index 525a337430..8c52b46423 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(preemptiveModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/PreemptiveModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.PreemptiveModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(preemptiveModule
Qt::QmlPrivate
)
+get_target_property(target_type preemptiveModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(preemptiveModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:preemptiveModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
index 644719cebf..22af8ecec5 100644
--- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
@@ -5,29 +5,26 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeMyPluginPreemptive : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginPreemptive : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.PreemptiveModule");
- qmlRegisterType<MyPluginType>("org.qtproject.PreemptiveModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeMyPluginPreemptive>("org.qtproject.PreemptiveModule", 1, 0,
+ "MyPluginType");
// Install into another namespace that should be protected
- qmlRegisterType<MyPluginType>("org.qtproject.PreemptedStrictModule", 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeMyPluginPreemptive>("org.qtproject.PreemptedStrictModule", 1, 0,
+ "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
index 590f10dced..7aaae64002 100644
--- a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
@@ -7,8 +7,6 @@
class MyPluginType : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
@@ -18,8 +16,6 @@ class MyPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
// Because the module is protected, this plugin should never be loaded
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/CMakeLists.txt
index 4cdb8e382c..061d0607ae 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(strictModule.2
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/StrictModule.2"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.StrictModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,6 +21,11 @@ qt_internal_add_cmake_library(strictModule.2
Qt::QmlPrivate
)
+get_target_property(target_type strictModule.2 TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(strictModule.2 PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:strictModule.2.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp
index 160f8f5ac6..9857a3bd1b 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp
@@ -5,26 +5,21 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeStrictV2 : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginStrictV2 : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.StrictModule");
- qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeStrictV2>(uri, 2, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/strictModule/CMakeLists.txt
index cc24178f40..d96471ff3f 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule/CMakeLists.txt
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/CMakeLists.txt
@@ -12,6 +12,7 @@ qt_internal_add_cmake_library(strictModule
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/org/qtproject/StrictModule"
SOURCES
plugin.cpp
+ MOC_OPTIONS "-Muri=org.qtproject.StrictModule"
LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -20,10 +21,20 @@ qt_internal_add_cmake_library(strictModule
Qt::QmlPrivate
)
+get_target_property(target_type strictModule TYPE)
+if(target_type STREQUAL STATIC_LIBRARY)
+ target_compile_definitions(strictModule PRIVATE QT_STATICPLUGIN)
+endif()
+
#### Keys ignored in scope 1:.:.:strictModule.pro:<TRUE>:
# IMPORT_FILES = "qmldir"
# TEMPLATE = "lib"
+qt_internal_extend_target(strictModule CONDITION NOT BUILD_SHARED_LIBS
+ DEFINES
+ QT_STATICPLUGIN
+)
+
qt_autogen_tools_initial_setup(strictModule)
# special case begin
file(COPY qmldir
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
index 39f7f86acf..f7844b811c 100644
--- a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
@@ -5,26 +5,21 @@
#include <QtQml/qqml.h>
#include <QDebug>
-class MyPluginType : public QObject
+class MyPluginTypeStrict : public QObject
{
Q_OBJECT
-public:
- MyPluginType(QObject *parent=nullptr) : QObject(parent) {}
};
-
-class MyPlugin : public QQmlExtensionPlugin
+class MyPluginStrict : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- MyPlugin() {}
-
void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == "org.qtproject.StrictModule");
- qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ qmlRegisterType<MyPluginTypeStrict>(uri, 1, 0, "MyPluginType");
}
};
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index 8d7fd5f458..832642d22a 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -22,6 +22,33 @@
#include <unistd.h>
#endif
+#ifdef QT_STATIC
+Q_IMPORT_QML_PLUGIN(MyPlugin);
+Q_IMPORT_QML_PLUGIN(MyPluginV2);
+Q_IMPORT_QML_PLUGIN(MyPluginV2_1);
+Q_IMPORT_QML_PLUGIN(MyPluginV2_2);
+Q_IMPORT_QML_PLUGIN(MyChildPlugin);
+Q_IMPORT_QML_PLUGIN(MyChildPluginV2);
+Q_IMPORT_QML_PLUGIN(MyChildPluginV2_1);
+
+Q_IMPORT_QML_PLUGIN(MyMixedPlugin);
+Q_IMPORT_QML_PLUGIN(QtQuick2Plugin);
+
+Q_IMPORT_QML_PLUGIN(MyPluginWithQml);
+Q_IMPORT_QML_PLUGIN(MyMixedPluginVersion);
+Q_IMPORT_QML_PLUGIN(MyPluginNested);
+
+Q_IMPORT_QML_PLUGIN(MyPluginStrict);
+Q_IMPORT_QML_PLUGIN(MyPluginStrictV2);
+Q_IMPORT_QML_PLUGIN(MyPluginNonStrict);
+Q_IMPORT_QML_PLUGIN(MyPluginPreemptive);
+Q_IMPORT_QML_PLUGIN(MyPluginPreemptedStrict);
+Q_IMPORT_QML_PLUGIN(MyPluginInvalidNamespace);
+Q_IMPORT_QML_PLUGIN(MyPluginInvalidFirstCommand);
+
+Q_IMPORT_QML_PLUGIN(MyPluginSingleton);
+#endif
+
#include <QtQuickTestUtils/private/testhttpserver_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
@@ -30,6 +57,7 @@
// This occurs because type registration is process-global, while the test
// cases should really be run in proper per-process isolation.
+
class tst_qqmlmoduleplugin : public QQmlDataTest
{
Q_OBJECT
@@ -57,9 +85,6 @@ private slots:
void importStrictModule_data();
void importProtectedModule();
void importVersionedModule();
- void importsChildPlugin();
- void importsChildPlugin2();
- void importsChildPlugin21();
void parallelPluginImport();
void multiSingleton();
void optionalPlugin();
@@ -206,9 +231,23 @@ void tst_qqmlmoduleplugin::importsPlugin()
QQmlEngine engine;
engine.addImportPath(m_importsDirectory);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(QString("plugin%1 created").arg(suffix)));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(QString("import%1 worked").arg(suffix)));
- QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+#ifndef QT_STATIC
+ const auto childPrefix =
+ qmlFile.startsWith("child") ? QLatin1String("child ") : QLatin1String("");
+ QTest::ignoreMessage(QtWarningMsg,
+ qPrintable(QString("%1plugin%2 created").arg(childPrefix, suffix)));
+ QTest::ignoreMessage(QtWarningMsg,
+ qPrintable(QString("%1import%2 worked").arg(childPrefix, suffix)));
+ const auto moduleURIsuffix =
+ childPrefix.empty() ? QLatin1String("") : QLatin1String(".ChildPlugin");
+ QTest::ignoreMessage(
+ QtWarningMsg,
+ qPrintable(QString("Module 'org.qtproject.AutoTestQmlPluginType%1' does not contain a "
+ "module "
+ "identifier directive - it cannot be protected from external "
+ "registrations.")
+ .arg(moduleURIsuffix)));
+#endif
QQmlComponent component(&engine, testFileUrl(qmlFile));
const auto errors = component.errors();
for (const QQmlError &err : errors)
@@ -228,6 +267,10 @@ void tst_qqmlmoduleplugin::importsPlugin_data()
QTest::newRow("2.0") << "2" << "works2.qml";
QTest::newRow("2.1") << "2.1" << "works21.qml";
QTest::newRow("2.2") << "2.2" << "works22.qml";
+
+ QTest::newRow("c1.0") << "" << "child.qml";
+ QTest::newRow("c2.0") << "2" << "child2.qml";
+ QTest::newRow("c2.1") << "2.1" << "child21.qml";
}
void tst_qqmlmoduleplugin::incorrectPluginCase()
@@ -242,9 +285,11 @@ void tst_qqmlmoduleplugin::incorrectPluginCase()
QString expectedError = QLatin1String("module \"org.qtproject.WrongCase\" plugin \"PluGin\" not found");
+#ifndef QT_STATIC
#if defined(Q_OS_DARWIN) || defined(Q_OS_WIN32)
#if defined(Q_OS_DARWIN)
- bool caseSensitive = pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE) == 1;
+ bool caseSensitive =
+ pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE) == 1;
#if QT_CONFIG(debug) && !QT_CONFIG(framework)
QString libname = "libPluGin_debug.dylib";
#else
@@ -260,7 +305,7 @@ void tst_qqmlmoduleplugin::incorrectPluginCase()
+ QLatin1Char('"');
}
#endif
-
+#endif
QCOMPARE(errors.at(0).description(), expectedError);
}
@@ -601,17 +646,24 @@ void tst_qqmlmoduleplugin::importStrictModule_data()
<< QString();
QTest::newRow("non-strict clash")
- << "import org.qtproject.NonstrictModule 1.0\n"
- "MyPluginType {}"
- << "Module 'org.qtproject.NonstrictModule' does not contain a module identifier directive - it cannot be protected from external registrations."
- << ":1:1: Cannot install element 'MyPluginType' into protected module 'org.qtproject.StrictModule' version '1'";
+ << "import QtQml\n"
+ "import org.qtproject.StrictModule 1.0 as S\n"
+ "import org.qtproject.NonstrictModule 1.0 as N\n"
+ "S.MyPluginType { Component.onCompleted: "
+ "Qt.createComponent(\"org.qtproject.NonstrictModule\", \"MyPluginType\") }"
+ << "Module 'org.qtproject.NonstrictModule' does not contain a module identifier "
+ "directive - it cannot be protected from external registrations."
+ << ":3:1: Cannot install element 'MyPluginType' into protected module "
+ "'org.qtproject.StrictModule' version '1'";
QTest::newRow("non-strict preemption")
- << "import org.qtproject.PreemptiveModule 1.0\n"
- "import org.qtproject.PreemptedStrictModule 1.0\n"
- "MyPluginType {}"
- << "Module 'org.qtproject.PreemptiveModule' does not contain a module identifier directive - it cannot be protected from external registrations."
- << ":2:1: Namespace 'org.qtproject.PreemptedStrictModule' has already been used for type registration";
+ << "import org.qtproject.PreemptiveModule 1.0\n"
+ "import org.qtproject.PreemptedStrictModule 1.0\n"
+ "MyPluginType {}"
+ << "Module 'org.qtproject.PreemptiveModule' does not contain a module identifier "
+ "directive - it cannot be protected from external registrations."
+ << ":2:1: Namespace 'org.qtproject.PreemptedStrictModule' has already been used for "
+ "type registration";
QTest::newRow("invalid namespace")
<< "import org.qtproject.InvalidNamespaceModule 1.0\n"
@@ -672,57 +724,6 @@ void tst_qqmlmoduleplugin::importVersionedModule()
QCOMPARE(component.errorString(), QString("%1:1 module \"org.qtproject.VersionedModule\" version 1.2 is not installed\n").arg(url.toString()));
}
-void tst_qqmlmoduleplugin::importsChildPlugin()
-{
- QQmlEngine engine;
- engine.addImportPath(m_importsDirectory);
- QTest::ignoreMessage(QtWarningMsg, "child plugin created");
- QTest::ignoreMessage(QtWarningMsg, "child import worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations.");
- QQmlComponent component(&engine, testFileUrl(QStringLiteral("child.qml")));
- const auto errors = component.errors();
- for (const QQmlError &err : errors)
- qWarning() << err;
- VERIFY_ERRORS(0);
- std::unique_ptr<QObject> object { component.create() };
- QVERIFY(object.get() != nullptr);
- QCOMPARE(object->property("value").toInt(),123);
-}
-
-void tst_qqmlmoduleplugin::importsChildPlugin2()
-{
- QQmlEngine engine;
- engine.addImportPath(m_importsDirectory);
- QTest::ignoreMessage(QtWarningMsg, "child plugin2 created");
- QTest::ignoreMessage(QtWarningMsg, "child import2 worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations.");
- QQmlComponent component(&engine, testFileUrl(QStringLiteral("child2.qml")));
- const auto errors = component.errors();
- for (const QQmlError &err : errors)
- qWarning() << err;
- VERIFY_ERRORS(0);
- std::unique_ptr<QObject> object { component.create() };
- QVERIFY(object.get() != nullptr);
- QCOMPARE(object->property("value").toInt(),123);
-}
-
-void tst_qqmlmoduleplugin::importsChildPlugin21()
-{
- QQmlEngine engine;
- engine.addImportPath(m_importsDirectory);
- QTest::ignoreMessage(QtWarningMsg, "child plugin2.1 created");
- QTest::ignoreMessage(QtWarningMsg, "child import2.1 worked");
- QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations.");
- QQmlComponent component(&engine, testFileUrl(QStringLiteral("child21.qml")));
- const auto errors = component.errors();
- for (const QQmlError &err : errors)
- qWarning() << err;
- VERIFY_ERRORS(0);
- std::unique_ptr<QObject> object { component.create() };
- QVERIFY(object.get() != nullptr);
- QCOMPARE(object->property("value").toInt(),123);
-}
-
void tst_qqmlmoduleplugin::parallelPluginImport()
{
QMutexLocker locker(&PluginThatWaits::initializeEngineEntered);