From: spo Date: Tue, 3 Nov 2015 09:01:48 +0000 (+0300) Subject: Add tests for features and fix some bugs. X-Git-Tag: V_2.1.0~206^2~21^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=06f051a9836d3a248da301bb7847336b2166183c;p=modules%2Fshaper.git Add tests for features and fix some bugs. --- diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index f2e24fad6..dc1ee767a 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -28,6 +28,7 @@ ADD_UNIT_TESTS( TestSketcherSetEqual.py TestSketcherSetFillet.py + TestFeatures.py TestFeaturesExtrusion.py TestFeaturesRevolution.py diff --git a/src/PythonAPI/model/construction/axis.py b/src/PythonAPI/model/construction/axis.py index 0afedf9bb..5e2694227 100644 --- a/src/PythonAPI/model/construction/axis.py +++ b/src/PythonAPI/model/construction/axis.py @@ -11,6 +11,7 @@ def addAxis(part, *args): Pass all args to Axis __init__ function. """ + assert(args) feature = part.addFeature("Axis") return Axis(feature, *args) diff --git a/src/PythonAPI/model/construction/plane.py b/src/PythonAPI/model/construction/plane.py index b2144d9ec..f007de248 100644 --- a/src/PythonAPI/model/construction/plane.py +++ b/src/PythonAPI/model/construction/plane.py @@ -11,6 +11,7 @@ def addPlane(part, *args): Pass all args to Plane __init__ function. """ + assert(args) feature = part.addFeature("Plane") return Plane(feature, *args) diff --git a/src/PythonAPI/model/construction/point.py b/src/PythonAPI/model/construction/point.py index d2448bc67..6d0428007 100644 --- a/src/PythonAPI/model/construction/point.py +++ b/src/PythonAPI/model/construction/point.py @@ -11,6 +11,7 @@ def addPoint(part, *args): Pass all args to Point __init__ function. """ + assert(args) feature = part.addFeature("Point") return Point(feature, *args) diff --git a/src/PythonAPI/model/exchange/exchange.py b/src/PythonAPI/model/exchange/exchange.py index a7b7daa0e..66f5c7809 100644 --- a/src/PythonAPI/model/exchange/exchange.py +++ b/src/PythonAPI/model/exchange/exchange.py @@ -11,6 +11,7 @@ def addImport(part, *args): Pass all args to Import __init__ function. """ + assert(args) feature = part.addFeature("Import") return Import(feature, *args) @@ -56,6 +57,7 @@ def exportToFile(part, *args): Pass all args to Export __init__ function. """ + assert(args) feature = part.addFeature("Export") return Export(feature, *args) diff --git a/src/PythonAPI/model/features/boolean.py b/src/PythonAPI/model/features/boolean.py index d746ffefd..95e27d019 100644 --- a/src/PythonAPI/model/features/boolean.py +++ b/src/PythonAPI/model/features/boolean.py @@ -10,26 +10,32 @@ from GeomAlgoAPI import * from model.roots import Interface -def addAddition(part, object, tool): +def addAddition(part, *args): """Inserts an addition to the given Part and executes the operation. This operation adds tool to the given object. """ + assert(args) + object, tool = args feature = part.addFeature("Boolean") return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_FUSE) -def addSubtraction(part, object, tool): +def addSubtraction(part, *args): """Inserts a subtraction to the given Part and executes the operation. This operation subtracts tool to the given object. """ + assert(args) + object, tool = args feature = part.addFeature("Boolean") return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_CUT) -def addIntersection(part, object, tool): +def addIntersection(part, *args): """Inserts an intersection to the given Part and executes the operation. This operation intersects tool to the given object. """ + assert(args) + object, tool = args feature = part.addFeature("Boolean") return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_COMMON) diff --git a/src/PythonAPI/model/parameter/parameter.py b/src/PythonAPI/model/parameter/parameter.py index 7dfe03c44..9b436b710 100644 --- a/src/PythonAPI/model/parameter/parameter.py +++ b/src/PythonAPI/model/parameter/parameter.py @@ -11,6 +11,7 @@ def addParameter(part, *args): Pass all args to Parameter __init__ function. """ + assert(args) feature = part.addFeature("Parameter") return Parameter(feature, *args) @@ -30,8 +31,8 @@ class Parameter(Interface): Interface.__init__(self, feature) assert(self._feature.getKind() == "Parameter") - self._variable = self._feature.data().selection("variable") - self._expression = self._feature.data().real("expression") + self._variable = self._feature.data().string("variable") + self._expression = self._feature.data().string("expression") assert(self._variable) assert(self._expression)