AutoTest: Fix checkstate evaluation

When the last item of a test got modified and gets a
different state than the rest of its siblings we failed
to set the resulting state of its parent to partially
checked.

Fixes: QTCREATORBUG-25702
Change-Id: I122b77b907dfa7fd14c31d8363b025254e0c115e
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-05-10 07:00:16 +02:00
parent ed1ed2aa24
commit c1abbf0802

View File

@@ -623,10 +623,6 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item)
bool foundPartiallyChecked = false; bool foundPartiallyChecked = false;
item->forFirstLevelChildren([&](ITestTreeItem *child) { item->forFirstLevelChildren([&](ITestTreeItem *child) {
if (foundPartiallyChecked || (foundChecked && foundUnchecked)) {
newState = Qt::PartiallyChecked;
return;
}
switch (child->type()) { switch (child->type()) {
case TestTreeItem::TestDataFunction: case TestTreeItem::TestDataFunction:
case TestTreeItem::TestSpecialFunction: case TestTreeItem::TestSpecialFunction:
@@ -638,6 +634,11 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item)
foundChecked |= (child->checked() == Qt::Checked); foundChecked |= (child->checked() == Qt::Checked);
foundUnchecked |= (child->checked() == Qt::Unchecked); foundUnchecked |= (child->checked() == Qt::Unchecked);
foundPartiallyChecked |= (child->checked() == Qt::PartiallyChecked); foundPartiallyChecked |= (child->checked() == Qt::PartiallyChecked);
if (foundPartiallyChecked || (foundChecked && foundUnchecked)) {
newState = Qt::PartiallyChecked;
return;
}
}); });
if (newState != Qt::PartiallyChecked) if (newState != Qt::PartiallyChecked)