forked from qt-creator/qt-creator
Fix removing unnamed quick tests...
...this was wrong especially when closing (the last) open project that contained unnamed quick tests. Change-Id: I6d030b6219d9f397a6ffb51a985ef4147eebec8a Reviewed-by: David Schulz <david.schulz@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -672,14 +672,16 @@ void TestCodeParser::removeTestsIfNecessary(const QString &fileName)
|
|||||||
emit testItemsRemoved(file, TestTreeModel::QuickTest);
|
emit testItemsRemoved(file, TestTreeModel::QuickTest);
|
||||||
}
|
}
|
||||||
// unnamed Quick Tests must be handled separately
|
// unnamed Quick Tests must be handled separately
|
||||||
removeUnnamedQuickTestsByName(fileName);
|
|
||||||
|
|
||||||
QSet<QString> filePaths;
|
QSet<QString> filePaths;
|
||||||
QList<QString> functionNames;
|
if (fileName.endsWith(QLatin1String(".qml"))) {
|
||||||
if (m_model->hasUnnamedQuickTests()) {
|
removeUnnamedQuickTestsByName(fileName);
|
||||||
m_model->qmlFilesAndFunctionNamesForMainFile(fileName, &filePaths, &functionNames);
|
emit unnamedQuickTestsRemoved(fileName);
|
||||||
foreach (const QString &file, filePaths)
|
} else {
|
||||||
emit testItemsRemoved(file, TestTreeModel::QuickTest);
|
m_model->qmlFilesForMainFile(fileName, &filePaths);
|
||||||
|
foreach (const QString &file, filePaths) {
|
||||||
|
removeUnnamedQuickTestsByName(file);
|
||||||
|
emit unnamedQuickTestsRemoved(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -615,19 +615,15 @@ QString TestTreeModel::getMainFileForUnnamedQuickTest(const QString &qmlFile) co
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestTreeModel::qmlFilesAndFunctionNamesForMainFile(const QString &mainFile,
|
void TestTreeModel::qmlFilesForMainFile(const QString &mainFile, QSet<QString> *filePaths) const
|
||||||
QSet<QString> *filePaths,
|
|
||||||
QList<QString> *functionNames) const
|
|
||||||
{
|
{
|
||||||
TestTreeItem *unnamed = unnamedQuickTests();
|
TestTreeItem *unnamed = unnamedQuickTests();
|
||||||
if (!unnamed)
|
if (!unnamed)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < unnamed->childCount(); ++i) {
|
for (int i = 0; i < unnamed->childCount(); ++i) {
|
||||||
const TestTreeItem *child = unnamed->child(i);
|
const TestTreeItem *child = unnamed->child(i);
|
||||||
if (child->mainFile() == mainFile) {
|
if (child->mainFile() == mainFile)
|
||||||
filePaths->insert(child->filePath());
|
filePaths->insert(child->filePath());
|
||||||
functionNames->append(child->name());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,8 +72,7 @@ public:
|
|||||||
QList<TestConfiguration *> getAllTestCases() const;
|
QList<TestConfiguration *> getAllTestCases() const;
|
||||||
QList<TestConfiguration *> getSelectedTests() const;
|
QList<TestConfiguration *> getSelectedTests() const;
|
||||||
QString getMainFileForUnnamedQuickTest(const QString &qmlFile) const;
|
QString getMainFileForUnnamedQuickTest(const QString &qmlFile) const;
|
||||||
void qmlFilesAndFunctionNamesForMainFile(const QString &mainFile, QSet<QString> *filePaths,
|
void qmlFilesForMainFile(const QString &mainFile, QSet<QString> *filePaths) const;
|
||||||
QList<QString> *functionNames) const;
|
|
||||||
QList<QString> getUnnamedQuickTestFunctions() const;
|
QList<QString> getUnnamedQuickTestFunctions() const;
|
||||||
QSet<QString> qmlFilesForProFile(const QString &proFile) const;
|
QSet<QString> qmlFilesForProFile(const QString &proFile) const;
|
||||||
bool hasUnnamedQuickTests() const;
|
bool hasUnnamedQuickTests() const;
|
||||||
|
Reference in New Issue
Block a user