diff --git a/qt/scientific_interfaces/Indirect/Reduction/DataReductionTab.cpp b/qt/scientific_interfaces/Indirect/Reduction/DataReductionTab.cpp index 608b7a3f7505..b4f4ec5400b1 100644 --- a/qt/scientific_interfaces/Indirect/Reduction/DataReductionTab.cpp +++ b/qt/scientific_interfaces/Indirect/Reduction/DataReductionTab.cpp @@ -31,8 +31,7 @@ DataReductionTab::DataReductionTab(IDataReduction *idrUI, QObject *parent) connect(this, SIGNAL(newInstrumentConfiguration()), this, SLOT(handleNewInstrumentConfiguration())); } -DataReductionTab::DataReductionTab(IDataReduction *idrUI, - std::unique_ptr algorithmRunner) +DataReductionTab::DataReductionTab(IDataReduction *idrUI, std::unique_ptr algorithmRunner) : InelasticTab(), m_idrUI(idrUI), m_tabRunning(false), m_algorithmRunner(std::move(algorithmRunner)) { connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(tabExecutionComplete(bool))); connect(this, SIGNAL(newInstrumentConfiguration()), this, SLOT(handleNewInstrumentConfiguration())); @@ -83,7 +82,7 @@ void DataReductionTab::tabExecutionComplete(bool error) { } } -void IndirectDataReductionTab::handleNewInstrumentConfiguration() { updateInstrumentConfiguration(); } +void DataReductionTab::handleNewInstrumentConfiguration() { updateInstrumentConfiguration(); } /** * Gets the current instrument workspace diff --git a/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferModelTest.h b/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferModelTest.h index 1235f02c413e..aeab12be3bc6 100644 --- a/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferModelTest.h +++ b/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferModelTest.h @@ -310,9 +310,7 @@ class ISISEnergyTransferModelTest : public CxxTest::TestSuite { TS_ASSERT_EQUALS(outputName, "instrument1234, 1235_analyser_reflection_Reduced"); } - void testRunIETAlgorithm() { - MantidQt::API::BatchAlgorithmRunner *batch = new MantidQt::API::BatchAlgorithmRunner(nullptr); - + void test_energyTransferAlgorithm() { IETInputData inputData("input_workspace1, input_workspace2", "input_workspace1, input_workspace2", true, false, true, "calibration_workspace"); IETConversionData conversionData(1.0, 1, 2); @@ -327,43 +325,18 @@ class ISISEnergyTransferModelTest : public CxxTest::TestSuite { InstrumentData instData("instrument", "analyser", "reflection"); - m_model->runIETAlgorithm(batch, instData, runData); - - // Wait for the algorithm to finish - std::this_thread::sleep_for(std::chrono::seconds(1)); - - TS_ASSERT_EQUALS(AnalysisDataService::Instance().doesExist("outputWS"), true); - if (AnalysisDataService::Instance().doesExist("outputWS")) { - ITableWorkspace_sptr outputWS = - Mantid::API::AnalysisDataService::Instance().retrieveWS("outputWS"); - - TS_ASSERT_EQUALS(outputWS->rowCount(), 1); - TS_ASSERT_EQUALS(outputWS->columnCount(), 18); - - TS_ASSERT_EQUALS(outputWS->getColumn(0)->name(), "Instrument"); - TS_ASSERT_EQUALS(outputWS->getColumn(1)->name(), "Analyser"); - TS_ASSERT_EQUALS(outputWS->getColumn(2)->name(), "Reflection"); + auto configuredAlg = m_model->energyTransferAlgorithm(instData, runData); + auto &runtimeProps = configuredAlg->getAlgorithmRuntimeProps(); + TS_ASSERT_EQUALS("instrument", runtimeProps.getPropertyValue("Instrument")); + TS_ASSERT_EQUALS("analyser", runtimeProps.getPropertyValue("Analyser")); + TS_ASSERT_EQUALS("reflection", runtimeProps.getPropertyValue("Reflection")); - TS_ASSERT_EQUALS(outputWS->getColumn(3)->name(), "InputFiles"); - TS_ASSERT_EQUALS(outputWS->getColumn(4)->name(), "SumFiles"); - TS_ASSERT_EQUALS(outputWS->getColumn(5)->name(), "LoadLogFiles"); - TS_ASSERT_EQUALS(outputWS->getColumn(6)->name(), "CalibrationWorkspace"); + TS_ASSERT_EQUALS("input_workspace1, input_workspace2", runtimeProps.getPropertyValue("InputFiles")); + TS_ASSERT_EQUALS("1", runtimeProps.getPropertyValue("SumFiles")); + TS_ASSERT_EQUALS("0", runtimeProps.getPropertyValue("LoadLogFiles")); - TS_ASSERT_EQUALS(outputWS->getColumn(7)->name(), "Efixed"); - TS_ASSERT_EQUALS(outputWS->getColumn(8)->name(), "SpectraRange"); - TS_ASSERT_EQUALS(outputWS->getColumn(9)->name(), "BackgroundRange"); - TS_ASSERT_EQUALS(outputWS->getColumn(10)->name(), "RebinString"); - - TS_ASSERT_EQUALS(outputWS->getColumn(11)->name(), "DetailedBalance"); - - TS_ASSERT_EQUALS(outputWS->getColumn(12)->name(), "UnitX"); - TS_ASSERT_EQUALS(outputWS->getColumn(13)->name(), "FoldMultipleFrames"); - TS_ASSERT_EQUALS(outputWS->getColumn(14)->name(), "OutputWorkspace"); - - TS_ASSERT_EQUALS(outputWS->getColumn(15)->name(), "GroupingMethod"); - TS_ASSERT_EQUALS(outputWS->getColumn(16)->name(), "GroupingString"); - TS_ASSERT_EQUALS(outputWS->getColumn(17)->name(), "GroupingFile"); - } + TS_ASSERT_EQUALS("1, 2", runtimeProps.getPropertyValue("SpectraRange")); + TS_ASSERT_EQUALS("0, 1", runtimeProps.getPropertyValue("BackgroundRange")); } void testValidateRunDetailedBalanceInvalid() { diff --git a/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferPresenterTest.h b/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferPresenterTest.h index 3c1eb04db95a..97c8f3459fdf 100644 --- a/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferPresenterTest.h +++ b/qt/scientific_interfaces/Indirect/test/Reduction/ISISEnergyTransferPresenterTest.h @@ -16,6 +16,7 @@ #include "MantidFrameworkTestHelpers/IndirectFitDataCreationHelper.h" #include "MantidKernel/WarningSuppressions.h" +#include "MantidQtWidgets/Common/MockAlgorithmRunner.h" using namespace MantidQt::CustomInterfaces; using namespace testing; @@ -33,6 +34,7 @@ class ISISEnergyTransferPresenterTest : public CxxTest::TestSuite { void setUp() override { auto model = std::make_unique>(); + auto algorithmRunner = std::make_unique>(); m_outputOptionsView = std::make_unique>(); m_instrumentConfig = std::make_unique>(); @@ -41,10 +43,12 @@ class ISISEnergyTransferPresenterTest : public CxxTest::TestSuite { ON_CALL(*m_view, getPlotOptionsView()).WillByDefault(Return(m_outputOptionsView.get())); m_model = model.get(); + m_algorithmRunner = algorithmRunner.get(); m_idrUI = std::make_unique>(); ON_CALL(*m_idrUI, getInstrumentConfiguration()).WillByDefault(Return(m_instrumentConfig.get())); - m_presenter = std::make_unique(m_idrUI.get(), m_view.get(), std::move(model)); + m_presenter = + std::make_unique(m_idrUI.get(), m_view.get(), std::move(model), std::move(algorithmRunner)); } void tearDown() override { @@ -52,6 +56,7 @@ class ISISEnergyTransferPresenterTest : public CxxTest::TestSuite { TS_ASSERT(Mock::VerifyAndClearExpectations(&m_instrumentConfig)); TS_ASSERT(Mock::VerifyAndClearExpectations(&m_view)); TS_ASSERT(Mock::VerifyAndClearExpectations(m_model)); + TS_ASSERT(Mock::VerifyAndClearExpectations(m_algorithmRunner)); TS_ASSERT(Mock::VerifyAndClearExpectations(&m_idrUI)); m_presenter.reset(); @@ -116,6 +121,7 @@ class ISISEnergyTransferPresenterTest : public CxxTest::TestSuite { std::unique_ptr> m_view; NiceMock *m_model; + NiceMock *m_algorithmRunner; std::unique_ptr> m_idrUI; std::unique_ptr> m_outputOptionsView; diff --git a/qt/scientific_interfaces/Indirect/test/Reduction/MockObjects.h b/qt/scientific_interfaces/Indirect/test/Reduction/MockObjects.h index b2564c259234..9e59989058b5 100644 --- a/qt/scientific_interfaces/Indirect/test/Reduction/MockObjects.h +++ b/qt/scientific_interfaces/Indirect/test/Reduction/MockObjects.h @@ -44,8 +44,8 @@ class MockIETModel : public IIETModel { MOCK_METHOD1(validateRunData, std::vector(IETRunData const &runData)); MOCK_METHOD1(validatePlotData, std::vector(IETPlotData const &plotData)); - MOCK_METHOD3(runIETAlgorithm, std::string(MantidQt::API::BatchAlgorithmRunner *batchAlgoRunner, - InstrumentData const &instData, IETRunData &runParams)); + MOCK_METHOD2(energyTransferAlgorithm, + MantidQt::API::IConfiguredAlgorithm_sptr(InstrumentData const &instData, IETRunData &runParams)); MOCK_CONST_METHOD2(plotRawAlgorithmQueue, std::deque(InstrumentData const &instData, IETPlotData const &plotData)); @@ -60,6 +60,7 @@ class MockIETModel : public IIETModel { MOCK_METHOD4(groupWorkspaces, std::vector(std::string const &groupName, std::string const &instrument, std::string const &groupOption, bool const shouldGroup)); + MOCK_CONST_METHOD0(outputGroupName, std::string()); MOCK_CONST_METHOD0(outputWorkspaceNames, std::vector()); }; diff --git a/qt/widgets/common/CMakeLists.txt b/qt/widgets/common/CMakeLists.txt index 619c82be64cf..873ee84f1519 100644 --- a/qt/widgets/common/CMakeLists.txt +++ b/qt/widgets/common/CMakeLists.txt @@ -5,7 +5,6 @@ set(SRC_FILES src/AlgorithmHistoryWindow.cpp src/AlgorithmInputHistory.cpp src/AlgorithmPropertiesWidget.cpp - src/AlgorithmRunner.cpp src/AlgorithmSelectorWidget.cpp src/AlgorithmRunner.cpp src/AlternateCSPythonLexer.cpp @@ -391,7 +390,6 @@ set(MOC_FILES inc/MantidQtWidgets/Common/OptionsPropertyWidget.h inc/MantidQtWidgets/Common/PropertyWidget.h inc/MantidQtWidgets/Common/PythonRunner.h - inc/MantidQtWidgets/Common/QtAlgorithmRunner.h inc/MantidQtWidgets/Common/QScienceSpinBox.h inc/MantidQtWidgets/Common/QtSignalChannel.h inc/MantidQtWidgets/Common/RepoTreeView.h @@ -523,7 +521,6 @@ set(INC_FILES inc/MantidQtWidgets/Common/QtAlgorithmRunner.h inc/MantidQtWidgets/Common/QSettingsHelper.h inc/MantidQtWidgets/Common/QStringUtils.h - inc/MantidQtWidgets/Common/QtAlgorithmRunner.h inc/MantidQtWidgets/Common/QtJSONUtils.h inc/MantidQtWidgets/Common/ScriptRepositoryView.h inc/MantidQtWidgets/Common/SelectionNotificationService.h