summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-01 13:11:03 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-08 08:34:30 +0200
commit1c08a41cb9b4a080b2465b1df70941e9c508bf1f (patch)
tree895b8fe91efcecc9faf2b8ff7f1a7019f1a19f7e /src/testlib/qtestcase.cpp
parentac2b15bdd0fa960644b956fbc9a8bf9fe5ff68f5 (diff)
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>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index ffcc7abbfe..5d2014b0c5 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -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)),