summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpluginloader
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qpluginloader')
-rw-r--r--tests/auto/qpluginloader/lib/lib.pro3
-rw-r--r--tests/auto/qpluginloader/qpluginloader.pro3
-rw-r--r--tests/auto/qpluginloader/theplugin/theplugin.pro4
-rw-r--r--tests/auto/qpluginloader/tst/tst.pro10
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp65
5 files changed, 82 insertions, 3 deletions
diff --git a/tests/auto/qpluginloader/lib/lib.pro b/tests/auto/qpluginloader/lib/lib.pro
index 7e842f2..96a9732 100644
--- a/tests/auto/qpluginloader/lib/lib.pro
+++ b/tests/auto/qpluginloader/lib/lib.pro
@@ -12,4 +12,7 @@ win32-borland: DEFINES += WIN32_BORLAND
#no special install rule for the library used by test
INSTALLS =
+symbian: {
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qpluginloader/qpluginloader.pro b/tests/auto/qpluginloader/qpluginloader.pro
index 50c17ed..382d6e4 100644
--- a/tests/auto/qpluginloader/qpluginloader.pro
+++ b/tests/auto/qpluginloader/qpluginloader.pro
@@ -1,9 +1,10 @@
+QT = core
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = lib \
theplugin \
tst
-!win32: !macx-*: SUBDIRS += almostplugin
+!win32: !macx-*: !symbian: SUBDIRS += almostplugin
TARGET = tst_qpluginloader
# no special install rule for subdir
diff --git a/tests/auto/qpluginloader/theplugin/theplugin.pro b/tests/auto/qpluginloader/theplugin/theplugin.pro
index d8d87b0..44b46b4 100644
--- a/tests/auto/qpluginloader/theplugin/theplugin.pro
+++ b/tests/auto/qpluginloader/theplugin/theplugin.pro
@@ -5,3 +5,7 @@ SOURCES = theplugin.cpp
TARGET = $$qtLibraryTarget(theplugin)
DESTDIR = ../bin
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro
index 5331f09..f848bb1 100644
--- a/tests/auto/qpluginloader/tst/tst.pro
+++ b/tests/auto/qpluginloader/tst/tst.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += ../tst_qpluginloader.cpp
TARGET = ../tst_qpluginloader
QT = core
+HEADERS += ../theplugin/plugininterface.h
win32 {
CONFIG(debug, debug|release) {
@@ -18,3 +19,12 @@ wince*: {
DEPLOYMENT += addFiles
}
+symbian: {
+ libDep.sources = mylib.dll
+ libDep.path = /sys/bin
+ pluginDep.sources = theplugin.dll
+ pluginDep.path = bin
+
+ DEPLOYMENT += libDep pluginDep
+}
+
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index 8221325..5f07c78 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -87,6 +87,12 @@
# endif
# define PREFIX ""
+#elif defined(Q_OS_SYMBIAN)
+# undef dll_VALID
+# define dll_VALID true
+# define SUFFIX ".dll"
+# define PREFIX ""
+
#else // all other Unix
# undef so_VALID
# define so_VALID true
@@ -116,7 +122,7 @@ private slots:
void errorString();
void loadHints();
void deleteinstanceOnUnload();
-
+ void checkingStubsFromDifferentDrives();
};
tst_QPluginLoader::tst_QPluginLoader()
@@ -210,7 +216,7 @@ void tst_QPluginLoader::errorString()
QVERIFY(loader.errorString() != unknown);
}
-#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined Q_OS_HPUX
+#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined Q_OS_HPUX && !defined Q_OS_SYMBIAN
{
QPluginLoader loader( sys_qualifiedLibraryName("almostplugin")); //a plugin with unresolved symbols
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
@@ -242,6 +248,11 @@ void tst_QPluginLoader::errorString()
QVERIFY(loader.instance() != static_cast<QObject*>(0));
QCOMPARE(loader.errorString(), unknown);
+ // Make sure that plugin really works
+ PluginInterface* theplugin = qobject_cast<PluginInterface*>(loader.instance());
+ QString pluginName = theplugin->pluginName();
+ QCOMPARE(pluginName, QLatin1String("Plugin ok"));
+
QCOMPARE(loader.unload(), true);
QCOMPARE(loader.errorString(), unknown);
}
@@ -286,6 +297,56 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
}
}
+void tst_QPluginLoader::checkingStubsFromDifferentDrives()
+{
+#if defined(Q_OS_SYMBIAN)
+
+ // This test needs C-drive + some additional drive (driveForStubs)
+
+ const QString driveForStubs("E:/");// != "C:/"
+ const QString stubDir("system/temp/stubtest/");
+ const QString stubName("dummyStub.qtplugin");
+ const QString fullStubFileName(stubDir + stubName);
+ QDir dir(driveForStubs);
+ bool test1(false); bool test2(false);
+
+ // initial clean up
+ QFile::remove(driveForStubs + fullStubFileName);
+ dir.rmdir(driveForStubs + stubDir);
+
+ // create a stub dir and do stub drive check
+ if (!dir.mkpath(stubDir))
+ QSKIP("Required drive not available for this test", SkipSingle);
+
+ {// test without stub, should not be found
+ QPluginLoader loader("C:/" + fullStubFileName);
+ test1 = !loader.fileName().length();
+ }
+
+ // create a stub to defined drive
+ QFile tempFile(driveForStubs + fullStubFileName);
+ tempFile.open(QIODevice::ReadWrite);
+ QFileInfo fileInfo(tempFile);
+
+ {// now should be found even tried to find from C:
+ QPluginLoader loader("C:/" + fullStubFileName);
+ test2 = (loader.fileName() == fileInfo.absoluteFilePath());
+ }
+
+ // clean up
+ tempFile.close();
+ if (!QFile::remove(driveForStubs + fullStubFileName))
+ QWARN("Could not remove stub file");
+ if (!dir.rmdir(driveForStubs + stubDir))
+ QWARN("Could not remove stub directory");
+
+ // test after cleanup
+ QVERIFY(test1);
+ QVERIFY(test2);
+
+#endif//Q_OS_SYMBIAN
+}
+
QTEST_APPLESS_MAIN(tst_QPluginLoader)
#include "tst_qpluginloader.moc"