summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qresourceengine
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/io/qresourceengine
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/io/qresourceengine')
-rw-r--r--tests/auto/corelib/io/qresourceengine/qresourceengine.pro34
-rw-r--r--tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp58
2 files changed, 33 insertions, 59 deletions
diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
index 1bb7bd9a90..d6e2cb3171 100644
--- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
+++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
@@ -10,26 +10,14 @@ runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runt
QMAKE_EXTRA_TARGETS = runtime_resource
PRE_TARGETDEPS += $${runtime_resource.target}
-wince* {
- deploy.files += runtime_resource.rcc parentdir.txt
- test.files = testqrc/*
- test.path = testqrc
- alias.files = testqrc/aliasdir/*
- alias.path = testqrc/aliasdir
- other.files = testqrc/otherdir/*
- other.path = testqrc/otherdir
- search1.files = testqrc/searchpath1/*
- search1.path = testqrc/searchpath1
- search2.files = testqrc/searchpath2/*
- search2.path = testqrc/searchpath2
- sub.files = testqrc/subdir/*
- sub.path = testqrc/subdir
- testsub.files = testqrc/test/*
- testsub.path = testqrc/test
- testsub2.files = testqrc/test/test/*
- testsub2.path = testqrc/test/test
- DEPLOYMENT += deploy test alias other search1 search2 sub testsub testsub2
- DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += \
+ parentdir.txt \
+ testqrc/*
+
+# Special case needed for runtime_resource.rcc installation,
+# since it does not exist at qmake runtime.
+load(testcase) # to get value of target.path
+runtime_resource_install.CONFIG = no_check_exist
+runtime_resource_install.files = $$OUT_PWD/$${runtime_resource.target}
+runtime_resource_install.path = $${target.path}
+INSTALLS += runtime_resource_install
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
index 4a2dfb3f22..2a40a64580 100644
--- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
@@ -59,9 +59,6 @@ private slots:
void searchPath();
void doubleSlashInRoot();
void setLocale();
-
-private:
- QString builddir;
};
Q_DECLARE_METATYPE(QLocale)
@@ -69,26 +66,15 @@ Q_DECLARE_METATYPE(qlonglong)
void tst_QResourceEngine::initTestCase()
{
- QVERIFY(QResource::registerResource("runtime_resource.rcc"));
- QVERIFY(QResource::registerResource("runtime_resource.rcc", "/secondary_root/"));
- QString srcdir(QLatin1String(SRCDIR));
- if (!srcdir.isEmpty()) {
- builddir = QDir::current().absolutePath();
- if (!builddir.endsWith(QDir::separator()))
- builddir.append(QDir::separator());
- QDir::setCurrent(srcdir);
- }
+ QVERIFY(QResource::registerResource(QFINDTESTDATA("runtime_resource.rcc")));
+ QVERIFY(QResource::registerResource(QFINDTESTDATA("runtime_resource.rcc"), "/secondary_root/"));
}
void tst_QResourceEngine::cleanupTestCase()
{
- if (!builddir.isEmpty()) {
- QDir::setCurrent(builddir);
- }
-
// make sure we don't leak memory
- QVERIFY(QResource::unregisterResource("runtime_resource.rcc"));
- QVERIFY(QResource::unregisterResource("runtime_resource.rcc", "/secondary_root/"));
+ QVERIFY(QResource::unregisterResource(QFINDTESTDATA("runtime_resource.rcc")));
+ QVERIFY(QResource::unregisterResource(QFINDTESTDATA("runtime_resource.rcc"), "/secondary_root/"));
}
void tst_QResourceEngine::checkStructure_data()
@@ -182,7 +168,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(0);
- info = QFileInfo("testqrc/test/test/test1.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test1.txt"));
QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test1.txt")
<< QString("abc")
<< QStringList()
@@ -190,7 +176,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/blahblah.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/blahblah.txt"));
QTest::newRow(QString(root + "text no slashes").toLatin1().constData()) << QString(root + "withoutslashes/blahblah.txt")
<< QString("qwerty")
<< QStringList()
@@ -199,7 +185,7 @@ void tst_QResourceEngine::checkStructure_data()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/test/test/test2.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test2.txt"));
QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test2.txt")
<< QString("def")
<< QStringList()
@@ -207,7 +193,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/currentdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt"));
QTest::newRow(QString(root + "currentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir.txt")
<< QString("\"This is the current dir\" ")
<< QStringList()
@@ -215,7 +201,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/currentdir2.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/currentdir2.txt"));
QTest::newRow(QString(root + "currentdir text2").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir2.txt")
<< QString("\"This is also the current dir\" ")
<< QStringList()
@@ -223,7 +209,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("parentdir.txt");
+ info = QFileInfo(QFINDTESTDATA("parentdir.txt"));
QTest::newRow(QString(root + "parentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/parentdir.txt")
<< QString("abcdefgihklmnopqrstuvwxyz ")
<< QStringList()
@@ -231,7 +217,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/subdir/subdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/subdir/subdir.txt"));
QTest::newRow(QString(root + "subdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/subdir/subdir.txt")
<< QString("\"This is in the sub directory\" ")
<< QStringList()
@@ -239,7 +225,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/test/testdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir.txt"));
QTest::newRow(QString(root + "testdir text").toLatin1().constData()) << QString(root + "test/testdir.txt")
<< QString("\"This is in the test directory\" ")
<< QStringList()
@@ -247,7 +233,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/otherdir/otherdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/otherdir/otherdir.txt"));
QTest::newRow(QString(root + "otherdir text").toLatin1().constData()) << QString(root + "otherdir/otherdir.txt")
<< QString("\"This is the other dir\" ")
<< QStringList()
@@ -255,7 +241,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/test/testdir2.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir2.txt"));
QTest::newRow(QString(root + "alias text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString("\"This is another file in this directory\" ")
<< QStringList()
@@ -263,7 +249,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale::c()
<< qlonglong(info.size());
- info = QFileInfo("testqrc/aliasdir/aliasdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt"));
QTest::newRow(QString(root + "korean text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString("\"This is a korean text file\" ")
<< QStringList()
@@ -271,7 +257,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale("ko")
<< qlonglong(info.size());
- info = QFileInfo("testqrc/aliasdir/aliasdir.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt"));
QTest::newRow(QString(root + "korean text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString("\"This is a korean text file\" ")
<< QStringList()
@@ -279,7 +265,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale("ko_KR")
<< qlonglong(info.size());
- info = QFileInfo("testqrc/test/german.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt"));
QTest::newRow(QString(root + "german text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString("Deutsch")
<< QStringList()
@@ -287,7 +273,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale("de")
<< qlonglong(info.size());
- info = QFileInfo("testqrc/test/german.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt"));
QTest::newRow(QString(root + "german text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString("Deutsch")
<< QStringList()
@@ -295,9 +281,9 @@ void tst_QResourceEngine::checkStructure_data()
<< QLocale("de_DE")
<< qlonglong(info.size());
- QFile file("testqrc/aliasdir/compressme.txt");
+ QFile file(QFINDTESTDATA("testqrc/aliasdir/compressme.txt"));
file.open(QFile::ReadOnly);
- info = QFileInfo("testqrc/aliasdir/compressme.txt");
+ info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/compressme.txt"));
QTest::newRow(QString(root + "compressed text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt")
<< QString(file.readAll())
<< QStringList()
@@ -416,9 +402,9 @@ void tst_QResourceEngine::checkUnregisterResource_data()
QTest::addColumn<QString>("file_check");
QTest::addColumn<int>("size");
- QTest::newRow("currentdir.txt") << builddir + QString("runtime_resource.rcc") << QString("/check_unregister/")
+ QTest::newRow("currentdir.txt") << QFINDTESTDATA("runtime_resource.rcc") << QString("/check_unregister/")
<< QString(":/check_unregister/runtime_resource/test/abc/123/+++/currentdir.txt")
- << (int)QFileInfo("testqrc/currentdir.txt").size();
+ << (int)QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt")).size();
}
void tst_QResourceEngine::checkUnregisterResource()