Salome HOME
Corrections for tests.
authorClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 24 Feb 2017 13:21:05 +0000 (14:21 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 24 Feb 2017 13:21:05 +0000 (14:21 +0100)
src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp
test.API/SHAPER/Primitives/TestAPI_Box.py

index 05b15667fd4f9b091b81b96bff6dc6fdecb18333..1e51608a3fa09909d390332859ae3fc71a43e398 100644 (file)
@@ -48,11 +48,11 @@ bool GeomAlgoAPI_Box::check()
     }
   } else if (myMethodType == MethodType::BOX_POINTS) {
     if (!myFirstPoint.get()) {
-      myError = "Box builder with points :: the first point is not correct.";
+      myError = "Box builder with points :: the first point is not valid.";
       return false;
     }
     if (!mySecondPoint.get()) {
-      myError = "Box builder with points :: the second point is not correct.";
+      myError = "Box builder with points :: the second point is not valid.";
       return false;
     }
     if (myFirstPoint->distance(mySecondPoint) < Precision::Confusion()) {
index c08ab48dfe379d4251712b8e41de68a8f121a4cc..a7512d382cf8e1f4e78586e82f7d38db87377051 100644 (file)
@@ -48,7 +48,7 @@ GeomAlgoAPI_Cylinder::GeomAlgoAPI_Cylinder(std::shared_ptr<GeomAPI_Ax2> theAxis,
 bool GeomAlgoAPI_Cylinder::check()
 {
   if (!myAxis) {
-    myError = "Cylinder builder :: axis is invalid.";
+    myError = "Cylinder builder :: axis is not valid.";
     return false;
   }
   if (myRadius < Precision::Confusion()) {
index a27dc623b950d9a0ada050a3a9c1b0af98be7ce9..8b3539c267ef43e2cc1db01ab9431b46a18a556d 100644 (file)
@@ -70,6 +70,15 @@ namespace GeomAlgoAPI_ShapeAPI
     std::shared_ptr<GeomAPI_Pnt> theBasePoint, std::shared_ptr<GeomAPI_Edge> theEdge,
     double theRadius, double theHeight) throw (GeomAlgoAPI_Exception)
   {
+    // Check if the base point is OK
+    if (!theBasePoint) {
+      throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid.");
+    }
+    // Check if the edge is OK
+    if (!theEdge) {
+      throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
+    }
+    
     std::shared_ptr<GeomAPI_Ax2> anAxis;
     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
                                                           theEdge->line()->direction()));
index 55ed0e89caebdb654ace2add8987a55b9a022021..3724bcf2e22693f16a5d8707a14e6ddde6e77e65 100644 (file)
@@ -53,29 +53,29 @@ bool GeomAlgoAPI_Translation::check()
   switch (myMethodType) {
     case BY_DISTANCE: {
       if (!myAxis) {
-        myError = "Translation builder :: axis is invalid.";
+        myError = "Translation builder :: axis is not valid.";
         return false;
       }
       if (!mySourceShape) {
-        myError = "Translation builder :: source shape is invalid.";
+        myError = "Translation builder :: source shape is not valid.";
         return false;
       }
       return true;
     }
     case BY_DIM: {
       if (!mySourceShape) {
-        myError = "Translation builder :: source shape is invalid.";
+        myError = "Translation builder :: source shape is not valid.";
         return false;
       }
       return true;
     }
     case BY_POINTS: {
       if (!myStartPoint) {
-        myError = "Translation builder :: start point is invalid.";
+        myError = "Translation builder :: start point is not valid.";
         return false;
       }
       if (!myEndPoint) {
-        myError = "Translation builder :: start point is invalid.";
+        myError = "Translation builder :: start point is not valid.";
         return false;
       }
       if (!mySourceShape) {
@@ -146,4 +146,4 @@ void GeomAlgoAPI_Translation::build()
   aShape->setImpl(new TopoDS_Shape(aResult));
   setShape(aShape);
   setDone(true);
-}
\ No newline at end of file
+}
index 0249e928b20f707ee98f1e541e6eba9d0ca36751..92f66dca1987b8c56e83d37847fc962776d6742d 100644 (file)
@@ -80,14 +80,14 @@ except myExcept,ec:
   assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
   
 try :    
-  Box_13 = shaperpy.makeBox(pnt2,None)
+  Box_13 = shaperpy.makeBox(None, pnt2)
   
 except myExcept,ec:
-  assert(ec.what() == "Box builder with points :: the second point is not correct.")
+  assert(ec.what() == "Box builder with points :: the first point is not valid.")
   
 try :    
-  Box_14 = shaperpy.makeBox(None,pnt2)
+  Box_14 = shaperpy.makeBox(pnt2, None)
   
 except myExcept,ec:
-  assert(ec.what() == "Box builder with points :: the first point is not correct.")
+  assert(ec.what() == "Box builder with points :: the second point is not valid.")