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>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-12-19 10:38:01 +01:00
parent 678a283498
commit 0655504015

View File

@ -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)),