AutoTest: Fix test tools handling for project settings

Fixes restoring project settings with enabled test tools but
having globally disabled these.
We need to take the real active state for test tools into
account not only the global one.
Kind of enhances b99d7623f3.

Change-Id: I29c8cc4fff7c82140da41d3c85823d5980c96d9f
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-09-03 15:27:03 +02:00
parent 87784a2e01
commit 481070d808

View File

@@ -96,6 +96,7 @@ void TestTreeModel::setupParsingConnections()
synchronizeTestFrameworks(); // we might have project settings synchronizeTestFrameworks(); // we might have project settings
m_parser->onStartupProjectChanged(project); m_parser->onStartupProjectChanged(project);
removeAllTestToolItems(); removeAllTestToolItems();
synchronizeTestTools();
m_checkStateCache = project ? AutotestPlugin::projectSettings(project)->checkStateCache() m_checkStateCache = project ? AutotestPlugin::projectSettings(project)->checkStateCache()
: nullptr; : nullptr;
onBuildSystemTestsUpdated(); // we may have old results if project was open before switching onBuildSystemTestsUpdated(); // we may have old results if project was open before switching
@@ -266,8 +267,14 @@ void TestTreeModel::onBuildSystemTestsUpdated()
m_checkStateCache->evolve(ITestBase::Tool); m_checkStateCache->evolve(ITestBase::Tool);
ITestTool *testTool = TestFrameworkManager::testToolForBuildSystemId(bs->project()->id()); ITestTool *testTool = TestFrameworkManager::testToolForBuildSystemId(bs->project()->id());
if (!testTool || !testTool->active()) if (!testTool)
return; return;
// FIXME
const TestProjectSettings *projectSettings = AutotestPlugin::projectSettings(bs->project());
if ((projectSettings->useGlobalSettings() && !testTool->active())
|| !projectSettings->activeTestTools().contains(testTool)) {
return;
}
ITestTreeItem *rootNode = testTool->rootNode(); ITestTreeItem *rootNode = testTool->rootNode();
QTC_ASSERT(rootNode, return); QTC_ASSERT(rootNode, return);
@@ -281,6 +288,7 @@ void TestTreeModel::onBuildSystemTestsUpdated()
rootNode->appendChild(item); rootNode->appendChild(item);
} }
revalidateCheckState(rootNode); revalidateCheckState(rootNode);
emit testTreeModelChanged();
} }
const QList<TestTreeItem *> TestTreeModel::frameworkRootNodes() const const QList<TestTreeItem *> TestTreeModel::frameworkRootNodes() const