summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-02-05 12:26:08 +0100
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-02-16 15:27:32 +0200
commit2ece8b61814a38a58e70f6209f3e6adf8657b481 (patch)
tree2a7cbb05747a88e0f3cf39bd9635fbfec64605ab
parentaba302ddefb95e009e05556a3cdec1a0d9d1b62c (diff)
downloadqt-creator-2ece8b61814a38a58e70f6209f3e6adf8657b481.tar.gz
Fix detection of tests on OSX
Change-Id: I662afadd17bd8b2f1fbc9269dc470430e871e582 Reviewed-by: Andre Poenitz <andre.poenitz@theqtcompany.com>
-rw-r--r--plugins/autotest/testcodeparser.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/autotest/testcodeparser.cpp b/plugins/autotest/testcodeparser.cpp
index 9d3772394b..179698294f 100644
--- a/plugins/autotest/testcodeparser.cpp
+++ b/plugins/autotest/testcodeparser.cpp
@@ -127,13 +127,19 @@ static QByteArray getFileContent(QString filePath)
static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
const CppTools::CppModelManager *cppMM)
{
+ static QString expectedHeaderPrefix
+ = Utils::HostOsInfo::isMacHost()
+ ? QLatin1String("QtTest.framework/Headers")
+ : QLatin1String("QtTest");
+
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
foreach (const CPlusPlus::Document::Include &inc, includes) {
// TODO this short cut works only for #include <QtTest>
// bad, as there could be much more different approaches
if (inc.unresolvedFileName() == QLatin1String("QtTest")
- && inc.resolvedFileName().endsWith(QLatin1String("QtTest/QtTest"))) {
+ && inc.resolvedFileName().endsWith(
+ QString::fromLatin1("%1/QtTest").arg(expectedHeaderPrefix))) {
return true;
}
}
@@ -142,7 +148,8 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
CPlusPlus::Snapshot snapshot = cppMM->snapshot();
const QSet<QString> allIncludes = snapshot.allIncludesForDocument(doc->fileName());
foreach (const QString &include, allIncludes) {
- if (include.endsWith(QLatin1String("QtTest/qtest.h"))) {
+
+ if (include.endsWith(QString::fromLatin1("%1/qtest.h").arg(expectedHeaderPrefix))) {
return true;
}
}
@@ -153,18 +160,24 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
const CppTools::CppModelManager *cppMM)
{
+ static QString expectedHeaderPrefix
+ = Utils::HostOsInfo::isMacHost()
+ ? QLatin1String("QtQuickTest.framework/Headers")
+ : QLatin1String("QtQuickTest");
+
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
foreach (const CPlusPlus::Document::Include &inc, includes) {
if (inc.unresolvedFileName() == QLatin1String("QtQuickTest/quicktest.h")
- && inc.resolvedFileName().endsWith(QLatin1String("QtQuickTest/quicktest.h"))) {
+ && inc.resolvedFileName().endsWith(
+ QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix))) {
return true;
}
}
if (cppMM) {
foreach (const QString &include, cppMM->snapshot().allIncludesForDocument(doc->fileName())) {
- if (include.endsWith(QLatin1String("QtQuickTest/quicktest.h")))
+ if (include.endsWith(QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix)))
return true;
}
}