diff options
Diffstat (limited to 'tests/auto/corelib/plugin')
12 files changed, 58 insertions, 13 deletions
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro index d8551faddc..7a2b8cd3b6 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro @@ -13,3 +13,11 @@ win32-borland: DEFINES += WIN32_BORLAND # This project is testdata for tst_qlibrary target.path = $$[QT_INSTALL_TESTS]/tst_qlibrary INSTALLS += target + +win32 { + CONFIG(debug, debug|release) { + DESTDIR = ../debug/ + } else { + DESTDIR = ../release/ + } +} diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro index a15393b214..8d5af0ea79 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro @@ -15,13 +15,20 @@ win32-borland: DEFINES += WIN32_BORLAND # We want to test if we can load a shared library with *any* filename... win32 { + CONFIG(debug, debug|release) { + BUILD_FOLDER = debug + } else { + BUILD_FOLDER = release + } + DESTDIR = ../$$BUILD_FOLDER/ + # vcproj and Makefile generators refer to target differently contains(TEMPLATE,vc.*) { src = $(TargetPath) } else { src = $(DESTDIR_TARGET) } - files = mylib.dl2 system.qt.test.mylib.dll + files = $$BUILD_FOLDER$${QMAKE_DIR_SEP}mylib.dl2 $$BUILD_FOLDER$${QMAKE_DIR_SEP}system.qt.test.mylib.dll } else { src = $(DESTDIR)$(TARGET) files = libmylib.so2 system.qt.test.mylib.so @@ -34,7 +41,7 @@ renamed_target.path = $$target.path for(file, files) { QMAKE_POST_LINK += $$QMAKE_COPY $$src ..$$QMAKE_DIR_SEP$$file && renamed_target.extra += $$QMAKE_COPY $$src $(INSTALL_ROOT)$${target.path}$$QMAKE_DIR_SEP$$file && - CLEAN_FILES += ../$$file + CLEAN_FILES += ..$$QMAKE_DIR_SEP$$file } renamed_target.extra = $$member(renamed_target.extra, 0, -2) QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2) diff --git a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro index ae6cf97891..d59cd738bf 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro +++ b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro @@ -13,5 +13,3 @@ win32 { } TESTDATA += ../library_path/invalid.so - -win32:CONFIG += insignificant_test # QTBUG-24151 diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp index 057db69174..e27085c293 100644 --- a/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp +++ b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp @@ -39,5 +39,14 @@ ** ****************************************************************************/ #include <QtPlugin> +#include <QObject> -Q_EXPORT_PLUGIN2(DebugPlugin, QObject) +class DebugPlugin : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "SomeIID") +public: + DebugPlugin() {} +}; + +#include "main.moc" diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp index 9542695112..d0875d2902 100644 --- a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp +++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp @@ -39,5 +39,14 @@ ** ****************************************************************************/ #include <QtPlugin> +#include <QObject> -Q_EXPORT_PLUGIN2(ReleasePlugin, QObject) +class ReleasePlugin : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "SomeIID") +public: + ReleasePlugin() {} +}; + +#include "main.moc" diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp index e6a83cf3d7..af76fcc4a2 100644 --- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp +++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp @@ -55,15 +55,23 @@ public: tst_QPlugin(); private slots: + void initTestCase(); void loadDebugPlugin(); void loadReleasePlugin(); }; tst_QPlugin::tst_QPlugin() - : dir("plugins") + : dir(QFINDTESTDATA("plugins")) { } +void tst_QPlugin::initTestCase() +{ + QVERIFY2(dir.exists(), + qPrintable(QString::fromLatin1("Cannot find the 'plugins' directory starting from '%1'"). + arg(QDir::toNativeSeparators(QDir::currentPath())))); +} + void tst_QPlugin::loadDebugPlugin() { foreach (QString fileName, dir.entryList(QStringList() << "*debug*", QDir::Files)) { diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp index 4b2057087a..eaad3ceff5 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp @@ -47,5 +47,3 @@ QString AlmostPlugin::pluginName() const unresolvedSymbol(); return QLatin1String("Plugin ok"); } - -Q_EXPORT_PLUGIN2(almostplugin, AlmostPlugin) diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h index 6658a5be8d..d64f5985ec 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h @@ -42,11 +42,13 @@ #define ALMOSTPLUGIN_H #include <QObject> +#include <QtPlugin> #include "../theplugin/plugininterface.h" class AlmostPlugin : public QObject, public PluginInterface { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json") Q_INTERFACES(PluginInterface) public: diff --git a/tests/auto/corelib/plugin/qpluginloader/empty.json b/tests/auto/corelib/plugin/qpluginloader/empty.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/empty.json @@ -0,0 +1 @@ +{} diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h index a568dd118d..fe0892c0fe 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h @@ -41,13 +41,19 @@ #ifndef PLUGININTERFACE_H #define PLUGININTERFACE_H +#include <QtCore/QtGlobal> + struct PluginInterface { virtual ~PluginInterface() {} virtual QString pluginName() const = 0; }; QT_BEGIN_NAMESPACE -Q_DECLARE_INTERFACE(PluginInterface, "com.trolltect.autotests.plugininterface/1.0") + +#define PluginInterface_iid "org.qt-project.Qt.autotests.plugininterface" + +Q_DECLARE_INTERFACE(PluginInterface, PluginInterface_iid) + QT_END_NAMESPACE #endif // PLUGININTERFACE_H diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp index b064901a4d..8c97956a5f 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp @@ -46,6 +46,3 @@ QString ThePlugin::pluginName() const { return QLatin1String("Plugin ok"); } - -Q_EXPORT_PLUGIN2(theplugin, ThePlugin) - diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h index b769aa6eed..3b8f12140e 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h @@ -42,11 +42,13 @@ #define THEPLUGIN_H #include <QObject> +#include <QtPlugin> #include "plugininterface.h" class ThePlugin : public QObject, public PluginInterface { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json") Q_INTERFACES(PluginInterface) public: |