From: azv Date: Thu, 20 Dec 2018 03:48:00 +0000 (+0300) Subject: [Code coverage GeomAlgoAPI]: Cover error messages in transformations X-Git-Tag: End2018~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ade7620f2fcd1326c0219e1e3e53652ca590e60a;p=modules%2Fshaper.git [Code coverage GeomAlgoAPI]: Cover error messages in transformations --- diff --git a/test.API/SHAPER/Transformations/TestAPI_Rotation.py b/test.API/SHAPER/Transformations/TestAPI_Rotation.py index 1e9323572..ece048f23 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Rotation.py +++ b/test.API/SHAPER/Transformations/TestAPI_Rotation.py @@ -21,6 +21,7 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction +from GeomAPI import GeomAPI_Shape as shape # Create Boxes Box_1 = shaperpy.makeBox(10.,10.,10.) @@ -113,3 +114,8 @@ try: Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2) except myExcept as ec: assert(ec.what() == "Rotation builder :: source shape is not valid.") + +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.") diff --git a/test.API/SHAPER/Transformations/TestAPI_Scale.py b/test.API/SHAPER/Transformations/TestAPI_Scale.py index 8fc2c5244..dccc3573d 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Scale.py +++ b/test.API/SHAPER/Transformations/TestAPI_Scale.py @@ -20,7 +20,7 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept -from GeomAPI import GeomAPI_Pnt as pnt +from GeomAPI import GeomAPI_Pnt as pnt, GeomAPI_Shape as shape # Create Boxes Box_1 = shaperpy.makeBox(10.,10.,10.) @@ -77,4 +77,19 @@ Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5) try : Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.) except myExcept as ec : - assert(ec.what() == "Scale builder :: center point is not valid.") \ No newline at end of file + assert(ec.what() == "Scale builder :: center point is not valid.") + +try : + Scale_19 = shaperpy.makeScale(None, pntOrigin, 2., 3., 1.) +except myExcept as ec : + assert(ec.what() == "Scale builder :: source shape is not valid.") + +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.") + +try : + Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2., 3., 1.) +except myExcept as ec : + assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.") diff --git a/test.API/SHAPER/Transformations/TestAPI_Symmetry.py b/test.API/SHAPER/Transformations/TestAPI_Symmetry.py index 6356d227f..b264aec3e 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Symmetry.py +++ b/test.API/SHAPER/Transformations/TestAPI_Symmetry.py @@ -24,6 +24,7 @@ from GeomAPI import GeomAPI_Pnt as pnt from GeomAPI import GeomAPI_Dir as direction from GeomAPI import GeomAPI_Ax1 as axis from GeomAPI import GeomAPI_Ax2 as plane +from GeomAPI import GeomAPI_Shape as shape # Create boxes Box_1 = shaperpy.makeBox(10., 10., 10.) @@ -63,10 +64,30 @@ Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin) Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1) try : - Symmetry_6 = shaperpy.makeSymmetry(Box_2, None) + Symmetry_3 = shaperpy.makeSymmetry(Box_3, None) except myExcept as ec : assert(ec.what() == "Symmetry builder :: point is not valid.") -Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ) -Symmetry_8 = shaperpy.makeSymmetry(Box_8, ax1) -Symmetry_13 = shaperpy.makeSymmetry(Box_13, planeXOY) +Symmetry_4 = shaperpy.makeSymmetry(Box_4, axZ) +Symmetry_5 = shaperpy.makeSymmetry(Box_5, ax1) +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.") + +try : + Symmetry_8 = shaperpy.makeSymmetry(None, axZ) +except myExcept as ec : + assert(ec.what() == "Symmetry builder :: source shape is not valid.") + +try : + Symmetry_9 = shaperpy.makeSymmetry(None, planeXOY) +except myExcept as ec : + assert(ec.what() == "Symmetry builder :: source shape is not valid.") + +try : + Symmetry_10 = shaperpy.makeSymmetry(shape(), pnt1) +except myExcept as ec : + assert(ec.what() == "Symmetry builder :: source shape does not contain any actual shape.") diff --git a/test.API/SHAPER/Transformations/TestAPI_Translation.py b/test.API/SHAPER/Transformations/TestAPI_Translation.py index 1d6a18c1f..1297ee7d2 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Translation.py +++ b/test.API/SHAPER/Transformations/TestAPI_Translation.py @@ -23,6 +23,7 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Ax1 as axis from GeomAPI import GeomAPI_Pnt as pnt from GeomAPI import GeomAPI_Dir as direction +from GeomAPI import GeomAPI_Shape as shape # Points pntOrigin = pnt(0.,0.,0.) @@ -72,49 +73,69 @@ try: except myExcept as ec: assert(ec.what() == "Translation builder :: axis is not valid.") -Translation_9 = shaperpy.makeTranslation(Box_5, ax4, 15.) +Translation_5 = shaperpy.makeTranslation(Box_5, ax4, 15.) MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 3, ax2, 15., 3) -Translation_10 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.) +Translation_6 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.) MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 3, ax2, 15., 3) -Translation_11 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.) +Translation_7 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.) MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 3, ax2, 15., 3) -Translation_12 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.) +Translation_8 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.) MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_9, ax1, 15., 3, ax2, 15., 3) try: - Translation_13 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.) + Translation_9 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.) except myExcept as ec: assert(ec.what() == "Translation builder :: axis is not valid.") MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_10, ax1, 15., 3, ax2, 15., 3) -Translation_18 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.) +Translation_10 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.) # Translations "By dimensions in X, in Y and in Z" -Translation_91 = shaperpy.makeTranslation(Box_11, 10., 20., 15.) -Translation_92 = shaperpy.makeTranslation(Box_11, 0., 20., 15.) -Translation_93 = shaperpy.makeTranslation(Box_11, 10., 0., 15.) -Translation_94 = shaperpy.makeTranslation(Box_11, 10., 20., 0.) -Translation_95 = shaperpy.makeTranslation(Box_11, -10., 20., 15.) -Translation_96 = shaperpy.makeTranslation(Box_11, 10., -20., 15.) -Translation_97 = shaperpy.makeTranslation(Box_11, 10., 20., -15.) +Translation_11 = shaperpy.makeTranslation(Box_11, 10., 20., 15.) +Translation_12 = shaperpy.makeTranslation(Box_11, 0., 20., 15.) +Translation_13 = shaperpy.makeTranslation(Box_11, 10., 0., 15.) +Translation_14 = shaperpy.makeTranslation(Box_11, 10., 20., 0.) +Translation_15 = shaperpy.makeTranslation(Box_11, -10., 20., 15.) +Translation_16 = shaperpy.makeTranslation(Box_11, 10., -20., 15.) +Translation_17 = shaperpy.makeTranslation(Box_11, 10., 20., -15.) # Translations "By two points" -Translation_99 = shaperpy.makeTranslation(Box_11, pnt1, pnt2) +Translation_18 = shaperpy.makeTranslation(Box_11, pnt1, pnt2) try: - Translation_100 = shaperpy.makeTranslation(Box_11, pnt1, pnt1) + Translation_19 = shaperpy.makeTranslation(Box_11, pnt1, pnt1) except myExcept as ec: assert(ec.what() == "Translation builder :: start point and end point coincide.") try: - Translation_101 = shaperpy.makeTranslation(Box_11, None, pnt1) + Translation_20 = shaperpy.makeTranslation(Box_11, None, pnt1) except myExcept as ec: assert(ec.what() == "Translation builder :: start point is not valid.") try: - Translation_102 = shaperpy.makeTranslation(Box_11, pnt1, None) + Translation_21 = shaperpy.makeTranslation(Box_11, pnt1, None) except myExcept as ec: - assert(ec.what() == "Translation builder :: end point is not valid.") \ No newline at end of file + assert(ec.what() == "Translation builder :: end point is not valid.") + +try: + Translation_22 = shaperpy.makeTranslation(None, ax1, 15.) +except myExcept as ec: + assert(ec.what() == "Translation builder :: source shape is not valid.") + +try: + Translation_23 = shaperpy.makeTranslation(None, 10., 20., 15.) +except myExcept as ec: + assert(ec.what() == "Translation builder :: source shape is not valid.") + +try: + Translation_24 = shaperpy.makeTranslation(None, pnt1, pnt2) +except myExcept as ec: + assert(ec.what() == "Translation builder :: source shape is invalid.") + +try: + Translation_25 = shaperpy.makeTranslation(shape(), ax1, 15.) +except myExcept as ec: + assert(ec.what() == "Translation builder :: source shape does not contain any actual shape.")