forked from qt-creator/qt-creator
AutoTest: Avoid unneeded duplication on rebuild
When the rebuild of the tree model has been triggered due to switching between grouping by filter or directory it could happen that some children did not get merged into others due to (insignificant) differences. Avoid this visual duplication by finding items similar to the one to be added and if there is one re-use this instead. Change-Id: Ife49593638e0af23ffc7353e305be4ea25eb2180 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -320,6 +320,28 @@ TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result)
|
||||
}
|
||||
}
|
||||
|
||||
TestTreeItem *QuickTestTreeItem::findChild(const TestTreeItem *other)
|
||||
{
|
||||
QTC_ASSERT(other, return nullptr);
|
||||
const Type otherType = other->type();
|
||||
|
||||
switch (type()) {
|
||||
case Root:
|
||||
if (otherType == TestCase && other->name().isEmpty())
|
||||
return unnamedQuickTests();
|
||||
return findChildByFileAndType(other->filePath(), otherType);
|
||||
case GroupNode:
|
||||
return findChildByFileAndType(other->filePath(), otherType);
|
||||
case TestCase:
|
||||
if (otherType != TestFunctionOrSet && otherType != TestDataFunction && otherType != TestSpecialFunction)
|
||||
return nullptr;
|
||||
return name().isEmpty() ? findChildByNameAndFile(other->name(), other->filePath())
|
||||
: findChildByName(other->name());
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool QuickTestTreeItem::modify(const TestParseResult *result)
|
||||
{
|
||||
QTC_ASSERT(result, return false);
|
||||
|
||||
Reference in New Issue
Block a user