summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpluginloader
diff options
context:
space:
mode:
authorikause <qt-info@nokia.com>2009-06-05 13:23:01 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-06-08 07:00:02 (GMT)
commit768cab51239a45f00d5ee3857efecd3d2cdcb99b (patch)
tree115c23175bd8547457c4e0b44d20aa7dfb7f1e63 /tests/auto/qpluginloader
parent7087433fb6f77746678963b1a97fc18daab831fa (diff)
downloadQt-768cab51239a45f00d5ee3857efecd3d2cdcb99b.zip
Qt-768cab51239a45f00d5ee3857efecd3d2cdcb99b.tar.gz
Qt-768cab51239a45f00d5ee3857efecd3d2cdcb99b.tar.bz2
Bug fix for 251870
A correction to this defect: 251870 QPluginLoader will only look for stubs from single drive, though plugins themselves can be located on any drive. Now the implementation goes through all the available drives if given path does not find corresponding stub-file in QPluginLoader::setFileName(). Since this is Symbian specific functionality, all the changes are behind Q_OS_SYMBIAN-flags. Note: Updated tests now need memory card being installed to device under test. Otherwise the test will be skipped. In case needed, drive is easy to change to tests. D-drive could also be a good option. modified: src/corelib/plugin/qpluginloader.cpp modified: tests/auto/qpluginloader/tst_qpluginloader.cpp Reviewed-By: Miikka Heikkinen
Diffstat (limited to 'tests/auto/qpluginloader')
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index 20ca997..3b2cb66 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -122,7 +122,7 @@ private slots:
void errorString();
void loadHints();
void deleteinstanceOnUnload();
-
+ void checkingStubsFromDifferentDrives();
};
tst_QPluginLoader::tst_QPluginLoader()
@@ -297,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"