summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-11-24 10:36:10 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-01 09:12:52 +0100
commit3385fb91e1e55e1bfa1f78dfb8ce2e9f3fdaedef (patch)
treeb77bb527bf3a21dc95a317248b2640c73751f629 /tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
parent13eba9ddf47d570fc4562c20fcfbacd1dfa4a61a (diff)
Fixed installation of corelib tests
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp')
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp40
1 files changed, 9 insertions, 31 deletions
diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
index 97e38ff2ef..c1f090afc5 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
@@ -115,10 +115,6 @@ class tst_QLibrary : public QObject
{
Q_OBJECT
-public:
- tst_QLibrary();
- virtual ~tst_QLibrary();
-
enum QLibraryOperation {
Load = 1,
Unload = 2,
@@ -127,6 +123,8 @@ enum QLibraryOperation {
DontSetFileName = 0x100
};
private slots:
+ void initTestCase();
+
void load();
void load_data();
void library_data();
@@ -146,33 +144,17 @@ private slots:
void fileName_data();
void fileName();
void multipleInstancesForOneLibrary();
-
-#ifdef Q_OS_WINCE
-private:
- QCoreApplication* app;
-#endif
};
-tst_QLibrary::tst_QLibrary()
-
-{
-#ifdef Q_OS_WINCE
- char* argv = "app";
- int argc = 1;
- app = new QCoreApplication(argc,&argv);
-#endif
-}
+typedef int (*VersionFunction)(void);
-tst_QLibrary::~tst_QLibrary()
+void tst_QLibrary::initTestCase()
{
-#ifdef Q_OS_WINCE
- app->quit();
-#endif
+ // chdir to our testdata directory, and use relative paths in some tests.
+ QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath();
+ QVERIFY2(QDir::setCurrent(testdatadir), qPrintable("Could not chdir to " + testdatadir));
}
-
-typedef int (*VersionFunction)(void);
-
void tst_QLibrary::version_data()
{
QTest::addColumn<QString>("lib");
@@ -376,10 +358,6 @@ void tst_QLibrary::errorString_data()
QString currDir = QDir::currentPath();
- QString srcDir = SRCDIR;
- if (srcDir.isEmpty())
- srcDir = currDir;
-
QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
#ifdef Q_OS_WINCE
@@ -394,7 +372,7 @@ void tst_QLibrary::errorString_data()
// QTest::newRow("bad unload") << (int)Unload << QString("nosuchlib.dll") << false << QString("QLibrary::unload_sys: Cannot unload nosuchlib.dll (The specified module could not be found.)");
#elif defined Q_OS_MAC
#else
- QTest::newRow("load invalid file") << (int)Load << srcDir + "/library_path/invalid.so" << false << QString("Cannot load library.*");
+ QTest::newRow("load invalid file") << (int)Load << QFINDTESTDATA("library_path/invalid.so") << false << QString("Cannot load library.*");
#endif
}
@@ -569,5 +547,5 @@ void tst_QLibrary::multipleInstancesForOneLibrary()
QCOMPARE(lib2.isLoaded(), true);
}
-QTEST_APPLESS_MAIN(tst_QLibrary)
+QTEST_MAIN(tst_QLibrary)
#include "tst_qlibrary.moc"