Support getting test data from qrc

If none of the other locations work, we can fall back to bundling
the test data in qrc to make it possible to include test data on
platforms that do not have any good way of deploying files to the
traditional file system, like Android.

Change-Id: I7779ce6be2380d551697cecfb9f76652d1fd0a38
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-07-01 13:11:03 +02:00
parent ac2b15bdd0
commit 1c08a41cb9

View File

@ -2708,6 +2708,13 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
}
}
// 4. Try resources
if (found.isEmpty()) {
QString candidate = QString::fromLatin1(":/%1").arg(base);
if (QFileInfo(candidate).exists())
found = candidate;
}
if (found.isEmpty()) {
QTest::qWarn(qPrintable(
QString::fromLatin1("testdata %1 could not be located!").arg(base)),