diff --git a/Framework/API/src/WorkspaceFactory.cpp b/Framework/API/src/WorkspaceFactory.cpp index 28d1ef21dc3c70ebaaf9fc2130a28e86cc356caf..bc8b78456c8f83a02e5d0dc056e1052220827107 100644 --- a/Framework/API/src/WorkspaceFactory.cpp +++ b/Framework/API/src/WorkspaceFactory.cpp @@ -128,24 +128,26 @@ void WorkspaceFactoryImpl::initializeFromParent( // deal with axis for (size_t i = 0; i < parent.m_axes.size(); ++i) { + if (parent.m_axes[i]->isSpectra()) { + // By default the child already has a spectra axis which + // does not need to get cloned from the parent. + continue; + } const bool isBinEdge = dynamic_cast<const BinEdgeAxis *const>(parent.m_axes[i]) != nullptr; const size_t newAxisLength = child.m_axes[i]->length() + (isBinEdge ? 1 : 0); const size_t oldAxisLength = parent.m_axes[i]->length(); - if (!differentSize && newAxisLength == oldAxisLength) { - // Need to delete the existing axis created in init above - delete child.m_axes[i]; + // Need to delete the existing axis created in init above + delete child.m_axes[i]; + child.m_axes[i] = nullptr; + if (newAxisLength == oldAxisLength) { // Now set to a copy of the parent workspace's axis child.m_axes[i] = parent.m_axes[i]->clone(&child); } else { - if (!parent.getAxis(i)->isSpectra()) // WHY??? - { - delete child.m_axes[i]; - // Call the 'different length' clone variant - child.m_axes[i] = parent.m_axes[i]->clone(newAxisLength, &child); - } + // Call the 'different length' clone variant + child.m_axes[i] = parent.m_axes[i]->clone(newAxisLength, &child); } } } diff --git a/Framework/Algorithms/test/ExtractFFTSpectrumTest.h b/Framework/Algorithms/test/ExtractFFTSpectrumTest.h index a21bc0765b21cf739186bb1e9dddaaf2d2067b9d..66bdd6e3f52d989873d12543ae047035c38b6e71 100644 --- a/Framework/Algorithms/test/ExtractFFTSpectrumTest.h +++ b/Framework/Algorithms/test/ExtractFFTSpectrumTest.h @@ -87,7 +87,7 @@ public: TS_ASSERT_EQUALS(inputWS->blocksize(), outputWS->blocksize()); // Units ( Axis 1 should be the same, Axis 0 should be "Time/ns" - TS_ASSERT_EQUALS(inputWS->getAxis(1)->unit(), outputWS->getAxis(1)->unit()); + TS_ASSERT(*inputWS->getAxis(1)->unit() == *outputWS->getAxis(1)->unit()); TS_ASSERT_EQUALS(outputWS->getAxis(0)->unit()->caption(), "Time"); TS_ASSERT_EQUALS(outputWS->getAxis(0)->unit()->label(), "ns"); } diff --git a/Framework/DataHandling/test/CompressEventsTest.h b/Framework/DataHandling/test/CompressEventsTest.h index f3a7b711f854c9333a988f70e36488ba037df57e..64c8568bfb1b09baf39cf1612b9474936a7c9d93 100644 --- a/Framework/DataHandling/test/CompressEventsTest.h +++ b/Framework/DataHandling/test/CompressEventsTest.h @@ -12,6 +12,7 @@ #include "MantidAPI/Axis.h" #include "MantidDataHandling/CompressEvents.h" #include "MantidDataObjects/Workspace2D.h" +#include "MantidKernel/Unit.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::MantidVecPtr; @@ -113,8 +114,8 @@ public: TS_ASSERT_DELTA(output->readY(0)[1], 2.0, 1e-5); TS_ASSERT_DELTA(output->readE(0)[1], M_SQRT2, 1e-5); TS_ASSERT_EQUALS(output->YUnit(), input->YUnit()); - TS_ASSERT_EQUALS(output->getAxis(0)->unit(), input->getAxis(0)->unit()); - TS_ASSERT_EQUALS(output->getAxis(1)->unit(), input->getAxis(1)->unit()); + TS_ASSERT(*output->getAxis(0)->unit() == *input->getAxis(0)->unit()); + TS_ASSERT(*output->getAxis(1)->unit() == *input->getAxis(1)->unit()); } // WEIGHTED_NOTIME tests diff --git a/Framework/Indexing/test/IndexSetTest.h b/Framework/Indexing/test/IndexSetTest.h index a8b337d480d3d3d8ec2a2485ac0436fc5a276de3..7108f6770e5cbcda0bf5ca9ff08a792546440161 100644 --- a/Framework/Indexing/test/IndexSetTest.h +++ b/Framework/Indexing/test/IndexSetTest.h @@ -139,7 +139,7 @@ public: } void test_isContiguous() { - const IndexSetTester empty; + const IndexSetTester empty{}; TS_ASSERT(empty.isContiguous()) const IndexSetTester range(3); TS_ASSERT(range.isContiguous())