aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
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 /tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
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>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp')
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp2
1 files changed, 1 insertions, 1 deletions
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)