1+ import math
12import pyMagix3D as Mgx3D
23
3- def test_command_join_entities (capfd ):
4+ def test_command_join_entities ():
45 ctx = Mgx3D .getStdContext ()
56 ctx .clearSession () # Clean the session after the previous test
67 gm = ctx .getGeomManager ()
@@ -56,7 +57,7 @@ def test_command_join_entities(capfd):
5657 ctx .redo ()
5758 assert gm .getNbCurves ()== 25
5859
59- def test_command_scaling (capfd ):
60+ def test_command_scaling ():
6061 ctx = Mgx3D .getStdContext ()
6162 ctx .clearSession () # Clean the session after the previous test
6263 gm = ctx .getGeomManager ()
@@ -93,7 +94,7 @@ def test_command_scaling(capfd):
9394 ctx .redo ()
9495 assertPoint (gm , "Pt0001" , 1 , 1 , 1 )
9596
96- def test_command_scaling_2 (capfd ):
97+ def test_command_scaling_2 ():
9798 ctx = Mgx3D .getStdContext ()
9899 ctx .clearSession () # Clean the session after the previous test
99100 gm = ctx .getGeomManager ()
@@ -109,7 +110,7 @@ def test_command_scaling_2(capfd):
109110 gm .scale (["Vol0000" ], 3.000000e+00 )
110111 assertPoint (tm , "Som0006" , 3 , 3 , 3 )
111112
112- def test_command_remove (capfd ):
113+ def test_command_remove ():
113114 ctx = Mgx3D .getStdContext ()
114115 ctx .clearSession () # Clean the session after the previous test
115116 gm = ctx .getGeomManager ()
@@ -146,7 +147,17 @@ def test_command_remove(capfd):
146147 assert gm .getNbSurfaces ()== 3
147148 assert gm .getNbCurves ()== 10
148149
149- def test_command_mirroring (capfd ):
150+ def test_command_mirror ():
151+ ctx = Mgx3D .getStdContext ()
152+ ctx .clearSession () # Clean the session after the previous test
153+ gm = ctx .getGeomManager ()
154+ tm = ctx .getTopoManager ()
155+ tm .newSphereWithTopo (Mgx3D .Point (0 , 0 , 0 ), 1 , Mgx3D .Portion .HUITIEME , True , 0.5 , 10 , 10 , "A" )
156+ assertClosePoint (gm , "Pt0000" , 0 , 0 , 1 )
157+ gm .mirror (["Vol0000" ], Mgx3D .Plane (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Vector (0 , 0 , 1 )))
158+ assertClosePoint (gm , "Pt0000" , 0 , 0 , - 1 )
159+
160+ def test_command_copy_mirror ():
150161 #Ce test prend aussi en charge l'appel à CommandGeomCopy
151162 ctx = Mgx3D .getStdContext ()
152163 ctx .clearSession () # Clean the session after the previous test
@@ -176,7 +187,7 @@ def test_command_mirroring(capfd):
176187 assert gm .getNbSurfaces ()== 17
177188 assert gm .getNbCurves ()== 32
178189
179- def test_command_common (capfd ):
190+ def test_command_common ():
180191 ctx = Mgx3D .getStdContext ()
181192 ctx .clearSession () # Clean the session after the previous test
182193 gm = ctx .getGeomManager ()
@@ -206,7 +217,7 @@ def test_command_common(capfd):
206217 assert gm .getNbSurfaces ()== 11
207218 assert gm .getNbCurves ()== 20
208219
209- def test_command_common2d (capfd ):
220+ def test_command_common2d ():
210221 ctx = Mgx3D .getStdContext ()
211222 ctx .clearSession () # Clean the session after the previous test
212223 gm = ctx .getGeomManager ()
@@ -240,4 +251,10 @@ def assertPoint(m, point, x, y, z):
240251 p = m .getCoord (point )
241252 assert p .getX () == x
242253 assert p .getY () == y
243- assert p .getZ () == z
254+ assert p .getZ () == z
255+
256+ def assertClosePoint (m , point , x , y , z ):
257+ p = m .getCoord (point )
258+ assert math .isclose (p .getX (), x , abs_tol = 1e-15 )
259+ assert math .isclose (p .getY (), y , abs_tol = 1e-15 )
260+ assert math .isclose (p .getZ (), z , abs_tol = 1e-15 )
0 commit comments