AutoTest: Allow run after build per project

It might make more sense to be able to enable this
per project instead of globally.

Task-number: QTCREATORBUG-16704
Change-Id: I2e29d3af62c428bcbb534b72b5eb13f1fbd83973
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2019-08-08 10:58:15 +02:00
parent 51382a846d
commit d12f90047a
5 changed files with 32 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include "autotestconstants.h"
#include "autotestplugin.h"
#include "testprojectsettings.h"
#include "testresultspane.h"
#include "testrunconfiguration.h"
#include "testsettings.h"
@@ -675,6 +676,20 @@ void TestRunner::buildFinished(bool success)
}
}
static bool runAfterBuild()
{
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
if (!project)
return false;
if (!project->namedSettings(Constants::SK_USE_GLOBAL).isValid())
return AutotestPlugin::settings()->runAfterBuild;
TestProjectSettings *projectSettings = AutotestPlugin::projectSettings(project);
return projectSettings->useGlobalSettings() ? AutotestPlugin::settings()->runAfterBuild
: projectSettings->runAfterBuild();
}
void TestRunner::onBuildQueueFinished(bool success)
{
if (m_executingTests || !m_selectedTests.isEmpty()) // paranoia!
@@ -683,7 +698,7 @@ void TestRunner::onBuildQueueFinished(bool success)
if (!success || m_runMode != TestRunMode::None)
return;
if (!AutotestPlugin::settings()->runAfterBuild)
if (!runAfterBuild())
return;
auto testTreeModel = TestTreeModel::instance();