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,
|
static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
|
||||||
const CppTools::CppModelManager *cppMM)
|
const CppTools::CppModelManager *cppMM)
|
||||||
{
|
{
|
||||||
static QString expectedHeaderPrefix
|
static QStringList expectedHeaderPrefixes
|
||||||
= Utils::HostOsInfo::isMacHost()
|
= Utils::HostOsInfo::isMacHost()
|
||||||
? QLatin1String("QtTest.framework/Headers")
|
? QStringList({ QLatin1String("QtTest.framework/Headers"), QLatin1String("QtTest") })
|
||||||
: QLatin1String("QtTest");
|
: QStringList({ QLatin1String("QtTest") });
|
||||||
|
|
||||||
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
||||||
|
|
||||||
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
||||||
// TODO this short cut works only for #include <QtTest>
|
// TODO this short cut works only for #include <QtTest>
|
||||||
// bad, as there could be much more different approaches
|
// bad, as there could be much more different approaches
|
||||||
if (inc.unresolvedFileName() == QLatin1String("QtTest")
|
if (inc.unresolvedFileName() == QLatin1String("QtTest")) {
|
||||||
&& inc.resolvedFileName().endsWith(
|
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||||
QString::fromLatin1("%1/QtTest").arg(expectedHeaderPrefix))) {
|
if (inc.resolvedFileName().endsWith(QString::fromLatin1("%1/QtTest").arg(prefix)))
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,9 +199,9 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
|
|||||||
CPlusPlus::Snapshot snapshot = cppMM->snapshot();
|
CPlusPlus::Snapshot snapshot = cppMM->snapshot();
|
||||||
const QSet<QString> allIncludes = snapshot.allIncludesForDocument(doc->fileName());
|
const QSet<QString> allIncludes = snapshot.allIncludesForDocument(doc->fileName());
|
||||||
foreach (const QString &include, allIncludes) {
|
foreach (const QString &include, allIncludes) {
|
||||||
|
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||||
if (include.endsWith(QString::fromLatin1("%1/qtest.h").arg(expectedHeaderPrefix))) {
|
if (include.endsWith(QString::fromLatin1("%1/qtest.h").arg(prefix)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,25 +211,31 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc,
|
|||||||
static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
||||||
const CppTools::CppModelManager *cppMM)
|
const CppTools::CppModelManager *cppMM)
|
||||||
{
|
{
|
||||||
static QString expectedHeaderPrefix
|
static QStringList expectedHeaderPrefixes
|
||||||
= Utils::HostOsInfo::isMacHost()
|
= Utils::HostOsInfo::isMacHost()
|
||||||
? QLatin1String("QtQuickTest.framework/Headers")
|
? QStringList({ QLatin1String("QtQuickTest.framework/Headers"),
|
||||||
: QLatin1String("QtQuickTest");
|
QLatin1String("QtQuickTest") })
|
||||||
|
: QStringList({ QLatin1String("QtQuickTest") });
|
||||||
|
|
||||||
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
||||||
|
|
||||||
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
||||||
if (inc.unresolvedFileName() == QLatin1String("QtQuickTest/quicktest.h")
|
if (inc.unresolvedFileName() == QLatin1String("QtQuickTest/quicktest.h")) {
|
||||||
&& inc.resolvedFileName().endsWith(
|
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||||
QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix))) {
|
if (inc.resolvedFileName().endsWith(
|
||||||
return true;
|
QString::fromLatin1("%1/quicktest.h").arg(prefix))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cppMM) {
|
if (cppMM) {
|
||||||
foreach (const QString &include, cppMM->snapshot().allIncludesForDocument(doc->fileName())) {
|
foreach (const QString &include, cppMM->snapshot().allIncludesForDocument(doc->fileName())) {
|
||||||
if (include.endsWith(QString::fromLatin1("%1/quicktest.h").arg(expectedHeaderPrefix)))
|
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||||
return true;
|
if (include.endsWith(QString::fromLatin1("%1/quicktest.h").arg(prefix)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user