From 7bba76d0ffd9a063078b1e3ac8df6204f68985e4 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 24 Sep 2020 10:48:31 +0200 Subject: [PATCH] AutoTest: Fix file path construction again b74ec90 fixed the cmake part, but broke the rest. Redo the file path construction to make it work with qmake, qbs and cmake on Windows when using Catch2. Change-Id: Ic41e015458ccf750421c29b1a200115c13db3ccf Reviewed-by: David Schulz --- src/plugins/autotest/catch/catchoutputreader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp index f3ece59f7e2..760d5214cb2 100644 --- a/src/plugins/autotest/catch/catchoutputreader.cpp +++ b/src/plugins/autotest/catch/catchoutputreader.cpp @@ -173,12 +173,12 @@ TestResultPtr CatchOutputReader::createDefaultResult() const result = new CatchResult(id(), m_testCaseInfo.first().name); result->setDescription(m_testCaseInfo.last().name); result->setLine(m_testCaseInfo.last().line); - const QFileInfo fileInfo(m_testCaseInfo.last().filename); - const Utils::FilePath filePath = Utils::FilePath::fromFileInfo(fileInfo); - if (!filePath.isEmpty()) { - result->setFileName(fileInfo.isAbsolute() + const QString givenPath = m_testCaseInfo.last().filename; + const Utils::FilePath filePath = Utils::FilePath::fromFileInfo(QFileInfo(givenPath)); + if (!givenPath.isEmpty()) { + result->setFileName(QDir::isAbsolutePath(givenPath) ? filePath.toString() - : QFileInfo(m_buildDir + '/' + filePath.toString()).canonicalFilePath()); + : QFileInfo(m_buildDir + '/' + givenPath).canonicalFilePath()); } } else { result = new CatchResult(id(), QString());