From d9570f07425a1dab1649fe153661e68809cee452 Mon Sep 17 00:00:00 2001 From: spo Date: Wed, 25 May 2016 08:56:19 +0300 Subject: [PATCH] Test ConstructionAPI_Point by old PythonAPI tests --- src/ConstructionAPI/CMakeLists.txt | 4 +++- src/ConstructionAPI/ConstructionAPI_Point.cpp | 8 -------- src/ConstructionAPI/ConstructionAPI_Point.h | 1 - src/ConstructionAPI/Test/TestPoint.cpp | 10 ---------- src/PythonAPI/Test/TestFeatures.py | 8 ++++++-- src/PythonAPI/model/construction/__init__.py | 2 +- 6 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/ConstructionAPI/CMakeLists.txt b/src/ConstructionAPI/CMakeLists.txt index 6242dd18c..83dbc2dd2 100644 --- a/src/ConstructionAPI/CMakeLists.txt +++ b/src/ConstructionAPI/CMakeLists.txt @@ -49,7 +49,9 @@ SET(SWIG_LINK_LIBRARIES ) SET(SWIG_MODULE_ConstructionAPI_EXTRA_DEPS ${SWIG_MODULE_ConstructionAPI_EXTRA_DEPS} - ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i) + ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i + ${PROJECT_HEADERS} + ) SWIG_ADD_MODULE(ConstructionAPI python ConstructionAPI.i ${PROJECT_HEADERS}) SWIG_LINK_LIBRARIES(ConstructionAPI ${SWIG_LINK_LIBRARIES}) diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index d7e9867a1..41349f9da 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -88,14 +88,6 @@ std::shared_ptr ConstructionAPI_Point::z() const //-------------------------------------------------------------------------------------- // TODO(spo): make add* as static functions of the class -PointPtr addPoint( - std::shared_ptr thePart) -{ - // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature("Point"); - return PointPtr(new ConstructionAPI_Point(aFeature)); -} - PointPtr addPoint( std::shared_ptr thePart, const ModelHighAPI_Double& theX, diff --git a/src/ConstructionAPI/ConstructionAPI_Point.h b/src/ConstructionAPI/ConstructionAPI_Point.h index 88d97e4a9..8f0a1943b 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.h +++ b/src/ConstructionAPI/ConstructionAPI_Point.h @@ -46,7 +46,6 @@ protected: //! Pointer on point object typedef std::shared_ptr PointPtr; -PointPtr addPoint(std::shared_ptr thePart); PointPtr addPoint(std::shared_ptr thePart, const ModelHighAPI_Double & theX, const ModelHighAPI_Double & theY, diff --git a/src/ConstructionAPI/Test/TestPoint.cpp b/src/ConstructionAPI/Test/TestPoint.cpp index cb17fc964..aeb6657d2 100644 --- a/src/ConstructionAPI/Test/TestPoint.cpp +++ b/src/ConstructionAPI/Test/TestPoint.cpp @@ -121,16 +121,6 @@ TEST_F(ConstructionAPI_Point_Constructor_Test, GetFeatureAndValues) { ConstructionAPI_Point aPoint(aFeature, 10, "20", std::string("x + 30")); } -TEST_F(ConstructionAPI_Point_Constructor_Test, addPoint) { - DocumentPtr aDocument(&aMockDocument, &null_deleter); - - EXPECT_CALL(aMockDocument, addFeature("Point", true)); - - testInitializeFeature(); - - PointPtr aPoint = addPoint(aDocument); -} - TEST_F(ConstructionAPI_Point_Constructor_Test, addPointWithValues) { DocumentPtr aDocument(&aMockDocument, &null_deleter); diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index 6d553d0cd..87042f9be 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -27,7 +27,10 @@ class FeaturesTestCase(FeaturesFixture): def test_assert_error_on_empty_args(self): features = [ - "addPoint", "addAxis", "addPlane", + # Implemented in C++, add* without arguments doesn't exist + # "addPoint", + + "addAxis", "addPlane", "addImport", "exportToFile", "addAddition", "addSubtraction", "addIntersection", "addExtrusion", @@ -46,9 +49,10 @@ class FeaturesTestCase(FeaturesFixture): self.fail("%s does not check empty args" % name) def test_initialize_without_attributes(self): + import ConstructionAPI model.construction.axis.Axis(self.part.addFeature("Axis")) model.construction.plane.Plane(self.part.addFeature("Plane")) - model.construction.point.Point(self.part.addFeature("Point")) + ConstructionAPI.ConstructionAPI_Point(self.part.addFeature("Point")) model.exchange.Import(self.part.addFeature("Import")) model.exchange.Export(self.part.addFeature("Export")) diff --git a/src/PythonAPI/model/construction/__init__.py b/src/PythonAPI/model/construction/__init__.py index e56746de6..6a8bf7149 100644 --- a/src/PythonAPI/model/construction/__init__.py +++ b/src/PythonAPI/model/construction/__init__.py @@ -1,6 +1,6 @@ """Package for Construction plugin for the Parametric Geometry API of the Modeler. """ -from point import addPoint +from ConstructionAPI import addPoint from axis import addAxis from plane import addPlane -- 2.39.2