forked from qt-creator/qt-creator
AutoTest: Ensure that removing and adding qml files is noticed
Task-number: QTCREATORBUG-17805 Change-Id: I068f6925fc39813a504205c4ef8e8b9f9e911189 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -131,7 +131,7 @@ void TestCodeParser::syncTestFrameworks(const QVector<Core::Id> &frameworkIds)
|
||||
updateTestTree();
|
||||
}
|
||||
|
||||
void TestCodeParser::emitUpdateTestTree()
|
||||
void TestCodeParser::emitUpdateTestTree(ITestParser *parser)
|
||||
{
|
||||
if (m_testCodeParsers.isEmpty())
|
||||
return;
|
||||
@@ -142,10 +142,10 @@ void TestCodeParser::emitUpdateTestTree()
|
||||
|
||||
qCDebug(LOG) << "adding singleShot";
|
||||
m_singleShotScheduled = true;
|
||||
QTimer::singleShot(1000, this, &TestCodeParser::updateTestTree);
|
||||
QTimer::singleShot(1000, this, [this, parser](){ updateTestTree(parser); });
|
||||
}
|
||||
|
||||
void TestCodeParser::updateTestTree()
|
||||
void TestCodeParser::updateTestTree(ITestParser *parser)
|
||||
{
|
||||
m_singleShotScheduled = false;
|
||||
if (m_codeModelParsing) {
|
||||
@@ -160,7 +160,7 @@ void TestCodeParser::updateTestTree()
|
||||
|
||||
m_fullUpdatePostponed = false;
|
||||
qCDebug(LOG) << "calling scanForTests (updateTestTree)";
|
||||
scanForTests();
|
||||
scanForTests(QStringList(), parser);
|
||||
}
|
||||
|
||||
static QStringList filterFiles(const QString &projectDir, const QStringList &files)
|
||||
@@ -315,7 +315,7 @@ static void parseFileForTests(const QVector<ITestParser *> &parsers,
|
||||
}
|
||||
}
|
||||
|
||||
void TestCodeParser::scanForTests(const QStringList &fileList)
|
||||
void TestCodeParser::scanForTests(const QStringList &fileList, ITestParser *parser)
|
||||
{
|
||||
if (m_parserState == Shutdown || m_testCodeParsers.isEmpty())
|
||||
return;
|
||||
@@ -355,7 +355,14 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
||||
list = Utils::filtered(list, [] (const QString &fn) {
|
||||
return !fn.endsWith(".qml");
|
||||
});
|
||||
m_model->markAllForRemoval();
|
||||
if (parser)
|
||||
TestFrameworkManager::instance()->rootNodeForTestFramework(parser->id())->markForRemovalRecursively(true);
|
||||
else
|
||||
m_model->markAllForRemoval();
|
||||
} else if (parser) {
|
||||
TestTreeItem *root = TestFrameworkManager::instance()->rootNodeForTestFramework(parser->id());
|
||||
for (const QString &filePath : list)
|
||||
root->markForRemovalRecursively(filePath);
|
||||
} else {
|
||||
for (const QString &filePath : list)
|
||||
m_model->markForRemoval(filePath);
|
||||
@@ -372,13 +379,20 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
||||
onFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
// use only a single parser or all current active?
|
||||
QVector<ITestParser *> codeParsers;
|
||||
if (parser)
|
||||
codeParsers.append(parser);
|
||||
else
|
||||
codeParsers.append(m_testCodeParsers);
|
||||
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "StartParsing";
|
||||
for (ITestParser *parser : m_testCodeParsers)
|
||||
for (ITestParser *parser : codeParsers)
|
||||
parser->init(list);
|
||||
|
||||
QFuture<TestParseResultPtr> future = Utils::map(list,
|
||||
[this](QFutureInterface<TestParseResultPtr> &fi, const QString &file) {
|
||||
parseFileForTests(m_testCodeParsers, fi, file);
|
||||
[this, codeParsers](QFutureInterface<TestParseResultPtr> &fi, const QString &file) {
|
||||
parseFileForTests(codeParsers, fi, file);
|
||||
},
|
||||
Utils::MapReduceOption::Unordered,
|
||||
QThread::LowestPriority);
|
||||
|
||||
Reference in New Issue
Block a user