Commit ecd8fd11 authored by Christian Stenger's avatar Christian Stenger

AutoTest: Ensure reparse even for unlisted Qml files

Files containing Quick tests are not necessarily listed
inside the project file.
If such an unlisted file is updated we have to scan for tests
even if it is not part of the project otherwise it would not
get updated inside the test tree.

Task-number: QTCREATORBUG-18692
Change-Id: I4c4c67d50b4fff13138b0ab3c884f5ea48a7b8bf
Reviewed-by: Oliver Wolff's avatarOliver Wolff <oliver.wolff@qt.io>
parent 60de0b74
......@@ -199,7 +199,7 @@ static bool parsingHasFailed;
/****** threaded parsing stuff *******/
void TestCodeParser::onDocumentUpdated(const QString &fileName)
void TestCodeParser::onDocumentUpdated(const QString &fileName, bool isQmlFile)
{
if (m_codeModelParsing || m_fullUpdatePostponed)
return;
......@@ -207,7 +207,8 @@ void TestCodeParser::onDocumentUpdated(const QString &fileName)
Project *project = SessionManager::startupProject();
if (!project)
return;
if (!SessionManager::projectContainsFile(project, Utils::FileName::fromString(fileName)))
// Quick tests: qml files aren't necessarily listed inside project files
if (!isQmlFile && !SessionManager::projectContainsFile(project, Utils::FileName::fromString(fileName)))
return;
scanForTests(QStringList(fileName));
......@@ -222,7 +223,7 @@ void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
{
const QString fileName = document->fileName();
if (!fileName.endsWith(".qbs"))
onDocumentUpdated(fileName);
onDocumentUpdated(fileName, true);
}
void TestCodeParser::onStartupProjectChanged(Project *project)
......
......@@ -88,7 +88,8 @@ private:
bool postponed(const QStringList &fileList);
void scanForTests(const QStringList &fileList = QStringList(), ITestParser *parser = nullptr);
void onDocumentUpdated(const QString &fileName);
// qml files must be handled slightly different
void onDocumentUpdated(const QString &fileName, bool isQmlFile = false);
void onTaskStarted(Core::Id type);
void onAllTasksFinished(Core::Id type);
void onFinished();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment