AutoTest: Fix marking for removal

If marking a test case for removal by file it could be
possible that children of this test case are not marked
because of being located inside a different file.
When performing sweep the test case and the not marked
children would be gone as the test case is marked and
so sweep would not look into the children.
This currently can only happen for gtest based test
cases as registering the tests is different and the test
case stores here the path of the first found test set.

Change-Id: I712054534307ee2839894c5148ae04b86b9df967
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-03-07 14:56:07 +01:00
parent 3b1e0e070a
commit 23e48fe207

View File

@@ -196,12 +196,13 @@ void TestTreeItem::markForRemovalRecursively(bool mark)
void TestTreeItem::markForRemovalRecursively(const QString &filePath)
{
if (m_filePath == filePath)
markForRemoval(true);
bool mark = m_filePath == filePath;
for (int row = 0, count = childCount(); row < count; ++row) {
TestTreeItem *child = childItem(row);
child->markForRemovalRecursively(filePath);
mark &= child->markedForRemoval();
}
markForRemoval(mark);
}
TestTreeItem *TestTreeItem::parentItem() const