From 215c29caf1c001944dc2129da48bb47e487d66fd Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Wed, 5 Feb 2020 02:00:13 -0600 Subject: [PATCH] Draft: implement unit test for angular dimension Previously the `makeAngularDimension` function produced error messages in the report view due to internal rounding of `App::PropertyAngles`. This was fixed in `Base::Quantity`, which now supports Python's `__round__` function. --- src/Mod/Draft/drafttests/test_creation.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Mod/Draft/drafttests/test_creation.py b/src/Mod/Draft/drafttests/test_creation.py index 43b99217cc..dde1b276cd 100644 --- a/src/Mod/Draft/drafttests/test_creation.py +++ b/src/Mod/Draft/drafttests/test_creation.py @@ -24,6 +24,7 @@ """Unit test for the Draft Workbench, object creation tests.""" import unittest +import math import FreeCAD as App import Draft import drafttests.auxiliary as aux @@ -206,6 +207,22 @@ class DraftCreation(unittest.TestCase): p3="diameter", p4=Vector(3, 1, 0)) self.assertTrue(obj1 and obj2, "'{}' failed".format(operation)) + def test_dimension_angular(self): + """Create an angular dimension between two lines at given angles.""" + operation = "Draft Dimension Angular" + _msg(" Test '{}'".format(operation)) + _msg(" Occasionally crashes") + center = Vector(0, 0, 0) + angle1 = math.radians(60) + angle2 = math.radians(10) + p3 = Vector(3, 1, 0) + _msg(" center={}".format(center)) + _msg(" angle1={0}, angle2={1}".format(math.degrees(angle1), + math.degrees(angle2))) + _msg(" point={}".format(p3)) + obj = Draft.makeAngularDimension(center, [angle1, angle2], p3) + self.assertTrue(obj, "'{}' failed".format(operation)) + def test_bspline(self): """Create a BSpline of three points.""" operation = "Draft BSpline"