diff options
Diffstat (limited to 'tests/auto/corelib/plugin/qpluginloader')
4 files changed, 30 insertions, 6 deletions
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro index 0004a8c712..70ab54a964 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro @@ -4,6 +4,7 @@ HEADERS = almostplugin.h SOURCES = almostplugin.cpp TARGET = almostplugin DESTDIR = ../bin +QT = core *-g++*:QMAKE_LFLAGS -= -Wl,--no-undefined # This is testdata for the tst_qpluginloader test. diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro index b510f8fb44..2ea9c27cc9 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro @@ -2,8 +2,11 @@ TEMPLATE = lib CONFIG += plugin HEADERS = theplugin.h SOURCES = theplugin.cpp -TARGET = $$qtLibraryTarget(theplugin) +# Use a predictable name for the plugin, no debug extension. Just like most apps do. +#TARGET = $$qtLibraryTarget(theplugin) +TARGET = theplugin DESTDIR = ../bin +QT = core # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro index 48650a5727..a7a9661a54 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro +++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro @@ -4,6 +4,7 @@ TARGET = ../tst_qpluginloader QT = core testlib SOURCES = ../tst_qpluginloader.cpp HEADERS = ../theplugin/plugininterface.h +CONFIG -= app_bundle win32 { CONFIG(debug, debug|release) { diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 155267f80b..34ec66f63f 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -59,7 +59,11 @@ # define bundle_VALID true # define dylib_VALID true # define so_VALID true -# define SUFFIX ".dylib" +//# ifdef QT_NO_DEBUG +# define SUFFIX ".dylib" +//# else +//# define SUFFIX "_debug.dylib" +//#endif # define PREFIX "lib" #elif defined(Q_OS_HPUX) && !defined(__ia64) @@ -79,11 +83,11 @@ #elif defined(Q_OS_WIN) # undef dll_VALID # define dll_VALID true -# ifdef QT_NO_DEBUG +//# ifdef QT_NO_DEBUG # define SUFFIX ".dll" -# else -# define SUFFIX "d.dll" -# endif +//# else +//# define SUFFIX "d.dll" +//# endif # define PREFIX "" #else // all other Unix @@ -111,6 +115,7 @@ private slots: #if defined (Q_OS_UNIX) void loadGarbage(); #endif + void relativePath(); void reloadPlugin(); }; @@ -294,6 +299,20 @@ void tst_QPluginLoader::loadGarbage() } #endif +void tst_QPluginLoader::relativePath() +{ + // Windows binaries run from release and debug subdirs, so we can't rely on the current dir. + const QString binDir = QFINDTESTDATA("bin"); + QVERIFY(!binDir.isEmpty()); + QCoreApplication::addLibraryPath(binDir); + QPluginLoader loader("theplugin"); + loader.load(); // not recommended, instance() should do the job. + PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance()); + QVERIFY(instance); + QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok")); + QVERIFY(loader.unload()); +} + void tst_QPluginLoader::reloadPlugin() { QPluginLoader loader; |