diff --git a/src/Mod/Path/PathTests/TestPathDepthParams.py b/src/Mod/Path/PathTests/TestPathDepthParams.py index cc25ec0088..a1d36eb9e3 100644 --- a/src/Mod/Path/PathTests/TestPathDepthParams.py +++ b/src/Mod/Path/PathTests/TestPathDepthParams.py @@ -251,3 +251,63 @@ class depthTestCases(unittest.TestCase): self.assertListEqual( r, expected, "Expected {}, but result of {}".format(expected, r) ) + + def test110(self): + """two custom user depths roughly equal to final depth""" + args = { + "clearance_height": 20.0, + "safe_height": 15.0, + "start_depth": 9.0, + "step_down": 3.0, + "z_finish_step": 0.0, + "final_depth": 0.0, + "user_depths": [0.00000001, 0.0], + } + + expected = [0] + + d = PathUtils.depth_params(**args) + r = [i for i in d] + self.assertListEqual( + r, expected, "Expected {}, but result of {}".format(expected, r) + ) + + def test120(self): + """four custom user depths with two roughly equal included""" + args = { + "clearance_height": 20.0, + "safe_height": 15.0, + "start_depth": 9.0, + "step_down": 3.0, + "z_finish_step": 0.0, + "final_depth": 0.0, + "user_depths": [6.0, 3.00000001, 3.0, 0.0], + } + + expected = [6.0, 3.0, 0.0] + + d = PathUtils.depth_params(**args) + r = [i for i in d] + self.assertListEqual( + r, expected, "Expected {}, but result of {}".format(expected, r) + ) + + def test130(self): + """five custom user depths with three roughly equal included""" + args = { + "clearance_height": 20.0, + "safe_height": 15.0, + "start_depth": 9.0, + "step_down": 3.0, + "z_finish_step": 0.0, + "final_depth": 0.0, + "user_depths": [6.0, 3.00000002, 3.00000001, 3.0, 0.0], + } + + expected = [6.0, 3.0, 0.0] + + d = PathUtils.depth_params(**args) + r = [i for i in d] + self.assertListEqual( + r, expected, "Expected {}, but result of {}".format(expected, r) + )