From 507a7e89ebfb31383e8765fe8bab0d9145a30d44 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 14 Mar 2016 15:36:03 +0100 Subject: [PATCH] AutoTest: Fix enabling run buttons If a parsing for tests is in progress the buttons might get enabled but they should be disabled until the parsing has finished. Change-Id: I3f089626983c219a9b54d8fc057a7ff51f11dc8c Reviewed-by: David Schulz --- src/plugins/autotest/testcodeparser.h | 1 + src/plugins/autotest/testresultspane.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index e9254221142..2755d33dd67 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -62,6 +62,7 @@ public: virtual ~TestCodeParser(); void setState(State state); State state() const { return m_parserState; } + bool isParsing() const { return m_parserState == PartialParse || m_parserState == FullParse; } void setDirty() { m_dirty = true; } #ifdef WITH_TESTS bool furtherParsingExpected() const diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 9192c75916d..9559ce5be70 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -31,6 +31,7 @@ #include "testrunner.h" #include "testsettings.h" #include "testtreemodel.h" +#include "testcodeparser.h" #include #include @@ -517,7 +518,8 @@ void TestResultsPane::onScrollBarRangeChanged(int, int max) void TestResultsPane::updateRunActions() { QString whyNot; - const bool enable = TestTreeModel::instance()->hasTests() + TestTreeModel *model = TestTreeModel::instance(); + const bool enable = !model->parser()->isParsing() && model->hasTests() && ProjectExplorer::ProjectExplorerPlugin::canRunStartupProject( ProjectExplorer::Constants::NORMAL_RUN_MODE, &whyNot); m_runAll->setEnabled(enable);