From 3146dadb42cb36aff83a62e831b8b4f4dc1562a7 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 20 Jan 2015 22:15:44 +0000 Subject: 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 --- .../corelib/plugin/qpluginloader/tst_qpluginloader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp') 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(loader.instance()); + QVERIFY(instance); + QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok")); + QVERIFY(loader.unload()); +} + void tst_QPluginLoader::reloadPlugin() { QPluginLoader loader; -- cgit v1.2.3