summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-12-19 10:38:01 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-12-19 16:00:59 +0100
commit0655504015c4f1ac9d65fef85c3c0554d7d8fc93 (patch)
tree2a7f59dba6ff44ed609d3fd7281e8ab8e1097504 /src/testlib
parent678a2834989c6571e6fae531447f468d9e03970b (diff)
Also search current directory in QFINDTESTDATA
On Android, none of the file system paths used for QFINDTESTDATA currently are suitable. We do have the possibility of putting test data in qrc, but in cases where the test is specifically testing access to the regular file system, we need a way to find files there as well. We add a fifth step when all other fail, which searches the current active directory for the data. Change-Id: I4f02f8530b5843eb282bd112ea03ed6a476593d6 Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/testlib')
-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 24d563045b..2851f83427 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2722,6 +2722,13 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
found = candidate;
}
+ // 5. Try current directory
+ if (found.isEmpty()) {
+ QString candidate = QString::fromLatin1("%1/%2").arg(QDir::currentPath()).arg(base);
+ if (QFileInfo(candidate).exists())
+ found = candidate;
+ }
+
if (found.isEmpty()) {
QTest::qWarn(qPrintable(
QString::fromLatin1("testdata %1 could not be located!").arg(base)),