@@ -207,7 +207,6 @@ def test_UnknowAttribute(self):
207207 self .assertRaises (AttributeError , (lambda aa : aa .unvalid ), p )
208208
209209 # @unittest.skip # no reason needed
210-
211210 def test_DataArray2DOperation (self ):
212211 root = create_scene ("rootNode" )
213212 v = numpy .array ([[0 , 0 , 0 ], [1 , 1 , 1 ], [2 , 2 , 2 ], [3 , 3 , 3 ]])
@@ -248,6 +247,36 @@ def t(c):
248247 c [0 ] = 1.0
249248 self .assertRaises (ValueError , (lambda c : t (c )), color )
250249
250+ def test_DataAsContainerNumpyArray_testIsDirtyOnDoubleAccess_ (self ):
251+ root = create_scene ("rootNode" )
252+
253+ root .addObject ("PointSetTopologyContainer" , points = [[0 , 0 , 0 ], [1 , 0 , 0 ]])
254+ modifier = root .addObject ("PointSetTopologyModifier" )
255+ mo = root .addObject ("MechanicalObject" )
256+ Sofa .Simulation .init (root )
257+
258+ modifier .addPoints (10 , True )
259+ self .assertEqual (len (mo .position ), 12 )
260+
261+ modifier .addPoints (10 , True )
262+ self .assertEqual (len (mo .position ), 22 )
263+
264+ def test_DataAsContainerNumpyArray_testIsDirtyOnDoubleWriteAccess_ (self ):
265+ root = create_scene ("rootNode" )
266+
267+ root .addObject ("PointSetTopologyContainer" , points = [[0 , 0 , 0 ], [1 , 0 , 0 ]])
268+ modifier = root .addObject ("PointSetTopologyModifier" )
269+ mo = root .addObject ("MechanicalObject" )
270+ Sofa .Simulation .init (root )
271+
272+ modifier .addPoints (10 , True )
273+ with mo .position .writeable () as w :
274+ self .assertEqual (len (w ), 12 )
275+
276+ modifier .addPoints (10 , True )
277+ with mo .position .writeable () as w :
278+ self .assertEqual (len (w ), 22 )
279+
251280 def test_DataAsContainerNumpyArray_ (self ):
252281 root = create_scene ("rootNode" )
253282 v = numpy .array ([[0 , 0 , 0 ], [1 , 1 , 1 ], [2 , 2 , 2 ], [3 , 3 , 3 ]])
@@ -319,10 +348,10 @@ def test_linkpath_between_two_scenes(self):
319348 root1 = create_scene ("root1" )
320349 root1 .addChild ("child1" )
321350 root2 = create_scene ("root2" )
322- root2 .addChild ("child2 )
351+ root2 .addChild ("child2" )
323352 root1 .child1 .addObject ("MechanicalObject" , name = "dofs1" , position = [[1.0 ,2.0 ,3.0 ]])
324- root2 .chdil2 .addObject ("MechanicalObject" , name = "dofs2" , position = root1 .child1 .dofs1 .position .linkpath )
325- self .assertEqual (root2 .dofs2 .position .getParent ().name , "dofs1" )
353+ root2 .child2 .addObject ("MechanicalObject" , name = "dofs2" , position = root1 .child1 .dofs1 .position .linkpath )
354+ self .assertEqual (str ( root2 .child2 . dofs2 .position .getParent ().linkpath ) , "@/child1/ dofs1.position " )
326355
327356 def test_set_value_from_string (self ):
328357 n = create_scene ("rootNode" )
0 commit comments