Salome HOME
Adjust test according to new behavior
authorazv <azv@opencascade.com>
Tue, 18 Feb 2020 12:09:34 +0000 (15:09 +0300)
committerazv <azv@opencascade.com>
Tue, 18 Feb 2020 12:09:34 +0000 (15:09 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp
test.API/SHAPER/Transformations/TestAPI_MultiRotation.py
test.API/SHAPER/Transformations/TestAPI_Rotation.py
test.API/SHAPER/Transformations/TestAPI_Scale.py
test.API/SHAPER/Transformations/TestAPI_Symmetry.py
test.API/SHAPER/Transformations/TestScale.py

index bde61cc26e94a1f596d93eae37f6dbc30c1c001c..8ebd28b1026c4e35126645e84e50f1d57f742355 100644 (file)
@@ -28,6 +28,10 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceSha
                                      std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
                                      double theScaleFactor)
 {
+  if (!theCenterPoint) {
+    myError = "Scale builder :: center point is not valid.";
+    return;
+  }
   if (fabs(theScaleFactor) < Precision::Confusion()) {
     myError = "Scale builder :: the scale factor is null.";
     return;
@@ -46,6 +50,10 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceSha
                                      double theScaleFactorY,
                                      double theScaleFactorZ)
 {
+  if (!theCenterPoint) {
+    myError = "Scale builder :: center point is not valid.";
+    return;
+  }
   if (fabs(theScaleFactorX) < Precision::Confusion()) {
     myError = "Scale builder :: the scale factor in X is null.";
     return;
@@ -70,6 +78,11 @@ void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr<GeomAPI_Shape> theSour
                                           double                         theScaleFactorY,
                                           double                         theScaleFactorZ)
 {
+  if (!theSourceShape) {
+    myError = "Scale builder :: source shape is not valid.";
+    return;
+  }
+
   const gp_Pnt& aCenterPoint = theCenterPoint->impl<gp_Pnt>();
 
   // Perform the rotation matrix
index f20b8b1a0f6c443c8040a913cb8674df9b46151d..1c063206cfa8ba2ef79efd81f63282c9bc8d0596 100644 (file)
@@ -50,7 +50,7 @@ except myExcept as ec:
 try:
   MultiRotation_4 = shaperpy.makeMultiRotation(None, ax1, 45., 5)
 except myExcept as ec:
-  assert(ec.what() == "Rotation builder :: source shape is not valid.")
+  assert(ec.what() == "Transformation :: incorrect input data.")
 
 try:
   MultiRotation_5 = shaperpy.makeMultiRotation(Box_4, None, 45., 5)
@@ -67,7 +67,7 @@ except myExcept as ec:
 try:
   MultiRotation_8 = shaperpy.makeMultiRotation(None, ax1, 5)
 except myExcept as ec:
-  assert(ec.what() == "Rotation builder :: source shape is not valid.")
+  assert(ec.what() == "Transformation :: incorrect input data.")
 
 try:
   MultiRotation_9 = shaperpy.makeMultiRotation(Box_7, None, 5)
index 3ebc9248fed1af040cde4c224732211140b02a6d..87632169e65b6ff58d9dceecde04aa9533fed419 100644 (file)
@@ -74,7 +74,7 @@ except myExcept as ec:
 try:
     Rotation_8 = shaperpy.makeRotation(None, ax1, 180)
 except myExcept as ec:
-    assert(ec.what() == "Rotation builder :: source shape is not valid.")
+    assert(ec.what() == "Transformation :: incorrect input data.")
 
 Rotation_9 = shaperpy.makeRotation(Box_8, pntOrigin, pnt1, pnt2)
 Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2)
@@ -112,9 +112,9 @@ except myExcept as ec:
 try:
     Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2)
 except myExcept as ec:
-    assert(ec.what() == "Rotation builder :: source shape is not valid.")
+    assert(ec.what() == "Transformation :: incorrect input data.")
 
 try:
     Rotation_18 = shaperpy.makeRotation(shape(), ax1, 450)
 except myExcept as ec:
-    assert(ec.what() == "Rotation builder :: source shape does not contain any actual shape.")
+    assert(ec.what() == "Transformation :: source shape does not contain any actual shape.")
index bc2c41a7fd112784b0c78b3434a86baddcb7c208..be3c60f4f6f65276beca5a0f8a2ef11b9c626c70 100644 (file)
@@ -86,7 +86,7 @@ except myExcept as ec :
 try :
     Scale_20 = shaperpy.makeScale(shape(), pntOrigin, 2.)
 except myExcept as ec :
-    assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.")
+    assert(ec.what() == "Transformation :: source shape does not contain any actual shape.")
 
 try :
     Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2., 3., 1.)
index 3c50f4298d576292a3ca78826bb95af71dc34fa7..1b321cfd8f114763881382c3301a3e1e910a9d88 100644 (file)
@@ -74,19 +74,19 @@ Symmetry_6 = shaperpy.makeSymmetry(Box_6, planeXOY)
 try :
     Symmetry_7 = shaperpy.makeSymmetry(None, pnt1)
 except myExcept as ec :
-    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+    assert(ec.what() == "Transformation :: incorrect input data.")
 
 try :
     Symmetry_8 = shaperpy.makeSymmetry(None, axZ)
 except myExcept as ec :
-    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+    assert(ec.what() == "Transformation :: incorrect input data.")
 
 try :
     Symmetry_9 = shaperpy.makeSymmetry(None, planeXOY)
 except myExcept as ec :
-    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+    assert(ec.what() == "Transformation :: incorrect input data.")
 
 try :
     Symmetry_10 = shaperpy.makeSymmetry(shape(), pnt1)
 except myExcept as ec :
-    assert(ec.what() == "Symmetry builder :: source shape does not contain any actual shape.")
+    assert(ec.what() == "Transformation :: source shape does not contain any actual shape.")
index 55fe459ab5e98e3ee250a033ae3800726e512e9a..edddcdc28ea376203cc97737c8efd2f98d25b2af 100644 (file)
@@ -177,19 +177,19 @@ model.testHaveNamingFaces(Scale_17, model, Part_1_doc)
 
 
 model.testNbResults(Scale_6, 0)
-assert(Scale_6.feature().error() == 'Scale builder :: the scale factor is null.')
+assert(Scale_6.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor is null.')
 
 model.testNbResults(Scale_8, 0)
 assert(Scale_8.feature().error() == 'Attribute "center_point" is not initialized.')
 
 model.testNbResults(Scale_14, 0)
-assert(Scale_14.feature().error() == 'Scale builder :: the scale factor in X is null.')
+assert(Scale_14.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in X is null.')
 
 model.testNbResults(Scale_15, 0)
-assert(Scale_15.feature().error() == 'Scale builder :: the scale factor in Y is null.')
+assert(Scale_15.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in Y is null.')
 
 model.testNbResults(Scale_16, 0)
-assert(Scale_16.feature().error() == 'Scale builder :: the scale factor in Z is null.')
+assert(Scale_16.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in Z is null.')
 
 model.testNbResults(Scale_18, 0)
 assert(Scale_18.feature().error() == 'Attribute "center_point" is not initialized.')