Unverified Commit c3d11876 authored by Gemma Guest's avatar Gemma Guest Committed by GitHub
Browse files

Merge pull request #33078 from mantidproject/load_bug

Algorithm history uses load version for "Load"
parents 00ad12ee bc580bdc
......@@ -177,8 +177,8 @@ const std::string ScriptBuilder::buildAlgorithmString(const AlgorithmHistory &al
Mantid::API::Algorithm_sptr algFresh;
// create a fresh version of the algorithm - unmanaged
if (name == "Load") {
algFresh =
AlgorithmManager::Instance().createUnmanaged(algHistory.getPropertyValue("LoaderName"), algHistory.version());
int version = std::stoi(algHistory.getPropertyValue("LoaderVersion"));
algFresh = AlgorithmManager::Instance().createUnmanaged(algHistory.getPropertyValue("LoaderName"), version);
} else {
algFresh = AlgorithmManager::Instance().createUnmanaged(name, algHistory.version());
}
......
......@@ -573,6 +573,27 @@ public:
m_ads.remove("MUSR00022725");
}
void test_Build_Load_Uses_Correct_version() {
auto alg = m_algFactory.create("Load", 1);
alg->initialize();
alg->setRethrows(true);
alg->setProperty("Filename", "IRS21360.raw");
alg->setProperty("OutputWorkspace", "IRS21360");
alg->execute();
auto ws = m_ads.retrieveWS<MatrixWorkspace>("IRS21360");
auto wsHist = ws->getHistory();
ScriptBuilder builder(wsHist.createView());
std::string scriptText = builder.build();
const std::string input_string = "IRS21360.raw";
const std::string output_string = "IRS21360";
TS_ASSERT(scriptText.find(input_string) != std::string::npos);
TS_ASSERT(scriptText.find(output_string) != std::string::npos);
m_ads.remove("IRS21360");
}
private:
AlgorithmFactoryImpl &m_algFactory;
AnalysisDataServiceImpl &m_ads;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment