From: dbv Date: Fri, 8 Jul 2016 15:03:17 +0000 (+0300) Subject: Issue #1540: Added test case. X-Git-Tag: V_2.5.0~212 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9b44b38c6a5199172aa2c4d2297954e170ac4308;p=modules%2Fshaper.git Issue #1540: Added test case. --- diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index ef618a982..1127806c7 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -132,4 +132,5 @@ ADD_UNIT_TESTS(TestConstants.py Test1064.py TestResults.py TestIntArray.py - Test1512.py) + Test1512.py + TestDoubleArray.py) diff --git a/src/ModelAPI/Test/TestDoubleArray.py b/src/ModelAPI/Test/TestDoubleArray.py new file mode 100644 index 000000000..88a1099c2 --- /dev/null +++ b/src/ModelAPI/Test/TestDoubleArray.py @@ -0,0 +1,30 @@ +#========================================================================= +# Initialization of the test +#========================================================================= +from ModelAPI import * +from GeomDataAPI import * +from GeomAlgoAPI import * +from GeomAPI import * + +import math + +aSession = ModelAPI_Session.get() + +#========================================================================= +# Test double array attribute +#========================================================================= +aPartSet = aSession.moduleDocument() +aSession.startOperation() +aSketchFeature = featureToCompositeFeature(aPartSet.addFeature("Sketch")) +aFeatureData = aSketchFeature.data() +anArray = aFeatureData.addAttribute("double_array", "DoubleArray") +aFeatureData.realArray("double_array").setSize(5) +assert(aFeatureData.realArray("double_array").size() == 5) +aFeatureData.realArray("double_array").setValue(0, 1) +assert(math.fabs(aFeatureData.realArray("double_array").value(0) - 1) < 10 ** -7) +aFeatureData.realArray("double_array").setValue(1, 1.5) +assert(math.fabs(aFeatureData.realArray("double_array").value(1) - 1.5) < 10 ** -7) + +#========================================================================= +# End of test +#=========================================================================