diff options
author | Alex Richardson <arichardson.kde@gmail.com> | 2015-01-20 22:15:44 +0000 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2015-02-26 13:31:47 +0000 |
commit | 3146dadb42cb36aff83a62e831b8b4f4dc1562a7 (patch) | |
tree | 5d6137649222f22640b31f353a12b9b435b11a65 /tests | |
parent | c8d64cbcc6728e8862cc16bb1d007349fd7012b4 (diff) |
Allow passing absolute paths without file extension to QPluginLoader
Previously QPluginLoader("/foo/bar/plugin").fileName() would return an
empty string even if /foo/bar/plugin.so existed, now we correctly find
that file.
Change-Id: Ibf6ba329e92956de45f695be65773caacf14050a
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index bdbb291d7f..cd77b188cc 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -120,6 +120,7 @@ private slots: void loadGarbage(); #endif void relativePath(); + void absolutePath(); void reloadPlugin(); void preloadedPlugin_data(); void preloadedPlugin(); @@ -406,6 +407,20 @@ void tst_QPluginLoader::relativePath() QVERIFY(loader.unload()); } +void tst_QPluginLoader::absolutePath() +{ + // 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()); + QVERIFY(QDir::isAbsolutePath(binDir)); + QPluginLoader loader(binDir + "/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; |