summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2018-06-07 17:07:09 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2018-06-21 14:14:36 +0000
commit22ec652ebfb659e8597d4986bd32c3ea82e3e075 (patch)
treee67536b51d764d8a04a6c7cfab18b0722fb8b726 /src
parent06044df0e3d881bcfa2537ad1301468d49ad544c (diff)
QFINDTESTDATA,Android: fix 'relative to test source'
When cross-compiling for Android on Windows the 'relative to test source' option could end up possibly matching with a matching folder in root ('/') because file is a Windows path and the canonicalFilePath of that path is "". Fixes tst_qxmlstream (and possibly others) on Android when Qt is compiled on Windows. Task-number: QTBUG-68596 Change-Id: I378374e41eea80f43680b3941adaa91fa604934a Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/testlib/qtestcase.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index adf4b9e1ef..acd676833e 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2135,8 +2135,9 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
srcdir.setFile(QFile::decodeName(builddir) + QLatin1String("/") + srcdir.filePath());
}
- QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath(), base);
- if (QFileInfo::exists(candidate)) {
+ const QString canonicalPath = srcdir.canonicalFilePath();
+ QString candidate = QString::fromLatin1("%1/%2").arg(canonicalPath, base);
+ if (!canonicalPath.isEmpty() && QFileInfo::exists(candidate)) {
found = candidate;
}
else if (QTestLog::verboseLevel() >= 2) {