forked from qt-creator/qt-creator
AutoTest: Fix parsing of Qt tests when using developerbuild
Change-Id: I226884c10e8fea48d08892b4dab3793b9babc0e5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Eike Ziller
parent
aac0086d1d
commit
500286cab7
@@ -177,20 +177,21 @@ static QByteArray getFileContent(QString filePath)
|
||||
static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
|
||||
const CppTools::CppModelManager *cppMM)
|
||||
{
|
||||
static QString expectedHeaderPrefix
|
||||
static QStringList expectedHeaderPrefixes
|
||||
= Utils::HostOsInfo::isMacHost()
|
||||
? QLatin1String("QtTest.framework/Headers")
|
||||
: QLatin1String("QtTest");
|
||||
? QStringList({ QLatin1String("QtTest.framework/Headers"), QLatin1String("QtTest") })
|
||||
: QStringList({ 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(
|
||||
QString::fromLatin1("%1/QtTest").arg(expectedHeaderPrefix))) {
|
||||
return true;
|
||||
if (inc.unresolvedFileName() == QLatin1String("QtTest")) {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
if (inc.resolvedFileName().endsWith(QString::fromLatin1("%1/QtTest").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,9 +199,9 @@ 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(QString::fromLatin1("%1/qtest.h").arg(expectedHeaderPrefix))) {
|
||||
return true;
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
if (include.endsWith(QString::fromLatin1("%1/qtest.h").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,25 +211,31 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
|
||||
static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
||||
const CppTools::CppModelManager *cppMM)
|
||||
{
|
||||
static QString expectedHeaderPrefix
|
||||
static QStringList expectedHeaderPrefixes
|
||||
= Utils::HostOsInfo::isMacHost()
|
||||
? QLatin1String("QtQuickTest.framework/Headers")
|
||||
: QLatin1String("QtQuickTest");
|
||||
? QStringList({ QLatin1String("QtQuickTest.framework/Headers"),
|
||||
QLatin1String("QtQuickTest") })
|
||||
: QStringList({ 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(
|
||||
QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix))) {
|
||||
return true;
|
||||
if (inc.unresolvedFileName() == QLatin1String("QtQuickTest/quicktest.h")) {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
if (inc.resolvedFileName().endsWith(
|
||||
QString::fromLatin1("%1/quicktest.h").arg(prefix))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cppMM) {
|
||||
foreach (const QString &include, cppMM->snapshot().allIncludesForDocument(doc->fileName())) {
|
||||
if (include.endsWith(QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix)))
|
||||
return true;
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
if (include.endsWith(QString::fromLatin1("%1/quicktest.h").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user