Salome HOME
Test ConstructionAPI_Point by old PythonAPI tests
authorspo <sergey.pokhodenko@opencascade.com>
Wed, 25 May 2016 05:56:19 +0000 (08:56 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:00 +0000 (14:41 +0300)
src/ConstructionAPI/CMakeLists.txt
src/ConstructionAPI/ConstructionAPI_Point.cpp
src/ConstructionAPI/ConstructionAPI_Point.h
src/ConstructionAPI/Test/TestPoint.cpp
src/PythonAPI/Test/TestFeatures.py
src/PythonAPI/model/construction/__init__.py

index 6242dd18c910d189ed567fed1ef3950fe2a4d4b8..83dbc2dd239863a63ae850e3db6729bbb340b97b 100644 (file)
@@ -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})
index d7e9867a19af75d4d79ec005de15c49a76fef357..41349f9daa658b8a687f7bfe09617db5467f7d63 100644 (file)
@@ -88,14 +88,6 @@ std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::z() const
 
 //--------------------------------------------------------------------------------------
 // TODO(spo): make add* as static functions of the class
-PointPtr addPoint(
-    std::shared_ptr<ModelAPI_Document> thePart)
-{
-  // TODO(spo): check that thePart is not empty
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature("Point");
-  return PointPtr(new ConstructionAPI_Point(aFeature));
-}
-
 PointPtr addPoint(
     std::shared_ptr<ModelAPI_Document> thePart,
     const ModelHighAPI_Double& theX,
index 88d97e4a9d5067b2e5ef36dec3b5a276f6086fd2..8f0a1943b2a3c1d7b9d130ba8aa9c99efd47f514 100644 (file)
@@ -46,7 +46,6 @@ protected:
 //! Pointer on point object
 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
 
-PointPtr addPoint(std::shared_ptr<ModelAPI_Document> thePart);
 PointPtr addPoint(std::shared_ptr<ModelAPI_Document> thePart,
                   const ModelHighAPI_Double & theX,
                   const ModelHighAPI_Double & theY,
index cb17fc964b83d76059268441879894ba1fc8aa3f..aeb6657d25974b89c07ee11c129fcb9be607d1aa 100644 (file)
@@ -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);
 
index 6d553d0cd1b54a4bb0949ff929915625948f1bcb..87042f9be14fd88fe016f14f98ac0b3b8bd998dc 100644 (file)
@@ -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"))
index e56746de60347e1d152c3b71684133860cdeadb1..6a8bf714998c3dd4ddaf719cdb7e1dc0fb2ce3d8 100644 (file)
@@ -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