AutoTest: Avoid triggering run tests while building

Disable respective actions while a build is running to avoid strange
side-effects or race conditions.

Change-Id: Ifc8d1c9fc9fd4d705cabd148b145708e23029dba
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2017-06-15 10:43:44 +02:00
parent 43a7fa28b1
commit ea86ff5eb0
4 changed files with 28 additions and 9 deletions

View File

@@ -42,6 +42,7 @@
#include <utils/progressindicator.h>
#include <utils/utilsicons.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <projectexplorer/buildmanager.h>
#include <QAction>
#include <QMenu>
@@ -113,7 +114,8 @@ TestNavigationWidget::~TestNavigationWidget()
void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
{
const bool enabled = !TestRunner::instance()->isTestRunning()
const bool enabled = !ProjectExplorer::BuildManager::isBuilding()
&& !TestRunner::instance()->isTestRunning()
&& m_model->parser()->state() == TestCodeParser::Idle;
const bool hasTests = m_model->hasTests();
@@ -170,8 +172,6 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
connect(selectAll, &QAction::triggered, m_view, &TestTreeView::selectAll);
connect(deselectAll, &QAction::triggered, m_view, &TestTreeView::deselectAll);
runAll->setEnabled(enabled && hasTests);
runSelected->setEnabled(enabled && hasTests);
selectAll->setEnabled(enabled && hasTests);
deselectAll->setEnabled(enabled && hasTests);
rescan->setEnabled(enabled);