forked from qt-creator/qt-creator
AutoTest: Use ITestFramework * instead of its id in some cases
Change-Id: Ic327e31185247b6479c78af8bf8156f44bb4bdfb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -179,7 +179,7 @@ QList<Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(const QS
|
||||
|
||||
static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const Document::Ptr &qmlJSDoc,
|
||||
const Core::Id &id,
|
||||
ITestFramework *framework,
|
||||
const QString &proFile = QString())
|
||||
{
|
||||
if (qmlJSDoc.isNull())
|
||||
@@ -197,7 +197,7 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr
|
||||
for (const QuickTestCaseSpec &testCase : testCases) {
|
||||
const QString testCaseName = testCase.m_caseName;
|
||||
|
||||
QuickTestParseResult *parseResult = new QuickTestParseResult(id);
|
||||
QuickTestParseResult *parseResult = new QuickTestParseResult(framework);
|
||||
parseResult->proFile = proFile;
|
||||
parseResult->itemType = TestTreeItem::TestCase;
|
||||
if (!testCaseName.isEmpty()) {
|
||||
@@ -208,7 +208,7 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr
|
||||
}
|
||||
|
||||
for (auto function : testCase.m_functions) {
|
||||
QuickTestParseResult *funcResult = new QuickTestParseResult(id);
|
||||
QuickTestParseResult *funcResult = new QuickTestParseResult(framework);
|
||||
funcResult->name = function.m_functionName;
|
||||
funcResult->displayName = function.m_functionName;
|
||||
funcResult->itemType = function.m_locationAndType.m_type;
|
||||
@@ -227,7 +227,7 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr
|
||||
|
||||
bool QuickTestParser::handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
CPlusPlus::Document::Ptr document,
|
||||
const Core::Id &id)
|
||||
ITestFramework *framework)
|
||||
{
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
if (quickTestName(document, m_cppSnapshot).isEmpty())
|
||||
@@ -250,7 +250,7 @@ bool QuickTestParser::handleQtQuickTest(QFutureInterface<TestParseResultPtr> fut
|
||||
for (const Document::Ptr &qmlJSDoc : qmlDocs) {
|
||||
if (futureInterface.isCanceled())
|
||||
break;
|
||||
result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id, proFile);
|
||||
result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, framework, proFile);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -298,8 +298,8 @@ void QuickTestParser::doUpdateWatchPaths(const QStringList &directories)
|
||||
}
|
||||
}
|
||||
|
||||
QuickTestParser::QuickTestParser()
|
||||
: CppParser()
|
||||
QuickTestParser::QuickTestParser(ITestFramework *framework)
|
||||
: CppParser(framework)
|
||||
{
|
||||
connect(ProjectExplorer::SessionManager::instance(),
|
||||
&ProjectExplorer::SessionManager::startupProjectChanged, [this] {
|
||||
@@ -319,7 +319,7 @@ void QuickTestParser::init(const QStringList &filesToParse, bool fullParse)
|
||||
m_qmlSnapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot();
|
||||
if (!fullParse) {
|
||||
// in a full parse we get the correct entry points by the respective main
|
||||
m_proFilesForQmlFiles = QuickTestUtils::proFilesForQmlFiles(id(), filesToParse);
|
||||
m_proFilesForQmlFiles = QuickTestUtils::proFilesForQmlFiles(framework(), filesToParse);
|
||||
// get rid of cached main cpp files that are going to get processed anyhow
|
||||
for (const QString &file : filesToParse) {
|
||||
if (m_mainCppFiles.contains(file)) {
|
||||
@@ -350,14 +350,14 @@ bool QuickTestParser::processDocument(QFutureInterface<TestParseResultPtr> futur
|
||||
if (proFile.isEmpty())
|
||||
return false;
|
||||
Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName);
|
||||
return checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id(), proFile);
|
||||
return checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, framework(), proFile);
|
||||
}
|
||||
if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName))
|
||||
return false;
|
||||
CPlusPlus::Document::Ptr document = m_cppSnapshot.find(fileName).value();
|
||||
if (!includesQtQuickTest(document, m_cppSnapshot))
|
||||
return false;
|
||||
return handleQtQuickTest(futureInterface, document, id());
|
||||
return handleQtQuickTest(futureInterface, document, framework());
|
||||
}
|
||||
|
||||
QString QuickTestParser::projectFileForMainCppFile(const QString &fileName) const
|
||||
|
||||
Reference in New Issue
Block a user