AutoTest: Ensure removal of empty items if possible

Change-Id: I2cac91e56e8f22f89f88bbc82cc5f7b526500529
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-01-18 09:19:56 +01:00
parent 13ba063696
commit 30000c80af
4 changed files with 13 additions and 1 deletions

View File

@@ -255,6 +255,10 @@ bool TestTreeModel::sweepChildren(TestTreeItem *item)
hasChanged = true;
} else if (child->hasChildren()) {
hasChanged |= sweepChildren(child);
if (!child->hasChildren() && child->removeOnSweepIfEmpty()) {
destroyItem(child);
revalidateCheckState(item);
}
} else {
hasChanged |= child->newlyAdded();
}
@@ -285,7 +289,7 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b
void TestTreeModel::revalidateCheckState(TestTreeItem *item)
{
QTC_ASSERT(item, return);
QTC_ASSERT(item->hasChildren(), return);
const TestTreeItem::Type type = item->type();
if (type == TestTreeItem::TestSpecialFunction || type == TestTreeItem::TestDataFunction
|| type == TestTreeItem::TestDataTag) {