Skip to content

Commit

Permalink
QFINDTESTDATA,Android: fix 'relative to test source'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
  • Loading branch information
Morten242 committed Jun 21, 2018
1 parent 06044df commit 22ec652
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/testlib/qtestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 22ec652

Please sign in to comment.