Part: add test for Geom2d.toShape

This commit is contained in:
wmayer
2023-11-20 12:34:20 +01:00
committed by wwmayer
parent 207bcfa80d
commit 9a14239d76
3 changed files with 22 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ set(CompoundTools_Scripts
set(Part_tests
parttests/__init__.py
parttests/Geom2d_tests.py
parttests/part_test_objects.py
parttests/regression_tests.py
parttests/TopoShapeListTest.py

View File

@@ -27,6 +27,7 @@ from FreeCAD import Units
from FreeCAD import Base
App = FreeCAD
from parttests.Geom2d_tests import Geom2dTests
from parttests.regression_tests import RegressionTests
from parttests.TopoShapeListTest import TopoShapeListTest

View File

@@ -0,0 +1,20 @@
import FreeCAD
vec2 = FreeCAD.Base.Vector2d
import Part
import unittest
class Geom2dTests(unittest.TestCase):
def test_toShape(self):
surf = Part.Cylinder()
p1 = vec2(1.0, -1.0)
p2 = vec2(2.0, -1.0)
l12 = Part.Geom2d.Line2dSegment(p1, p2)
e1 = l12.toShape()
e2 = l12.toShape(surf)
self.assertNotEqual(e1.curveOnSurface(0), None)
self.assertNotEqual(e2.curveOnSurface(0), None)