From 1574effec75ae7fe1e6217b6f72cb7a5e23624e1 Mon Sep 17 00:00:00 2001
From: Harry Jeffery <henry.jeffery@stfc.ac.uk>
Date: Mon, 30 Mar 2015 14:14:42 +0100
Subject: [PATCH] Refs #11355 Transfer recalc extents test

---
 .../Framework/MDAlgorithms/test/CutMDTest.h   | 27 +++++++++++++++++++
 .../test/python/mantid/api/CutMDTest.py       |  7 -----
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
index 8a0a5ae3bb7..46ac4722666 100644
--- a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
+++ b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
@@ -136,6 +136,33 @@ public:
 
     AnalysisDataService::Instance().remove(wsName);
   }
+
+  void test_recalculate_extents_with_3_bin_arguments() {
+    const std::string wsName = "__CutMDTest_recalc_extents_with_3_bin_args";
+
+    auto algCutMD = FrameworkManager::Instance().createAlgorithm("CutMD");
+    algCutMD->initialize();
+    algCutMD->setRethrows(true);
+    algCutMD->setProperty("InputWorkspace", sharedWSName);
+    algCutMD->setProperty("OutputWorkspace", wsName);
+    algCutMD->setProperty("P1Bin", "0,0.3,0.8");
+    algCutMD->setProperty("P2Bin", "0.1");
+    algCutMD->setProperty("P3Bin", "0.1");
+    algCutMD->setProperty("CheckAxes", false);
+    algCutMD->setProperty("NoPix", true);
+    algCutMD->execute();
+    TS_ASSERT(algCutMD->isExecuted());
+
+    IMDWorkspace_sptr outWS =
+      AnalysisDataService::Instance().retrieveWS<IMDWorkspace>(wsName);
+    TS_ASSERT(outWS.get());
+
+    TS_ASSERT_DELTA(outWS->getDimension(0)->getMinimum(), 0.0, 1E-6);
+    TS_ASSERT_DELTA(outWS->getDimension(0)->getMaximum(), 0.6, 1E-6);
+    TS_ASSERT_EQUALS(outWS->getDimension(0)->getNBins(), 2);
+
+    AnalysisDataService::Instance().remove(wsName);
+  }
 };
 
 #endif /* MANTID_MDALGORITHMS_CUTMDTEST_H_ */
diff --git a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
index 695fb9aff26..a758ef66d25 100644
--- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
+++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
@@ -22,13 +22,6 @@ class CutMDTest(unittest.TestCase):
     def tearDown(self):
         DeleteWorkspace(self.__in_md )
 
-    def test_recalculate_extents_with_3_bin_arguments(self):
-        out_md = CutMD(self.__in_md, P1Bin=[0, 0.3, 0.8], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=False, NoPix=True)
-        dim = out_md.getDimension(0)
-        self.assertAlmostEqual(0, dim.getMinimum(), 6, "Wrong minimum")
-        self.assertEqual(2, dim.getNBins(), "Wrong calculated number of bins")
-        self.assertAlmostEqual(0.6, dim.getMaximum(), 6, "Wrong calculated maximum")
-        
     def test_truncate_extents(self):
         out_md = CutMD(self.__in_md, P1Bin=[0, 1.1, 1], P2Bin=[21], P3Bin=[0.1], CheckAxes=False, NoPix=True)
   
-- 
GitLab