From 61864ab4e3284e50ae2961e4b759e62aae391523 Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Mon, 20 Apr 2020 13:24:02 +0200 Subject: [PATCH] Add test for the new mode of a box --- src/PrimitivesPlugin/box_widget.xml | 3 --- test.API/SHAPER/Primitives/TestAPI_Box.py | 14 ++++++++------ test.API/SHAPER/Primitives/TestBox.py | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/PrimitivesPlugin/box_widget.xml b/src/PrimitivesPlugin/box_widget.xml index 53eb9c0f2..bcd5ba91a 100644 --- a/src/PrimitivesPlugin/box_widget.xml +++ b/src/PrimitivesPlugin/box_widget.xml @@ -8,7 +8,6 @@ default="10.0" icon="" tooltip="Dimension in X"> - - - diff --git a/test.API/SHAPER/Primitives/TestAPI_Box.py b/test.API/SHAPER/Primitives/TestAPI_Box.py index 726b07260..9bf40cd7f 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Box.py +++ b/test.API/SHAPER/Primitives/TestAPI_Box.py @@ -62,32 +62,34 @@ Box_8 = shaperpy.makeBox(pnt1,pnt2) try : Box_9 = shaperpy.makeBox(pnt1,pnt1) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the distance between the two points is null.") + assert(ec.what() == "Box builder with two points :: the distance between the two points is null.") try : pnt3 = pnt(0.,50.,50.) Box_10 = shaperpy.makeBox(pnt1,pnt3) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") try : pnt4 = pnt(50.,0.,50.) Box_11 = shaperpy.makeBox(pnt1,pnt4) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") try : pnt5 = pnt(50.,50.,0.) Box_12 = shaperpy.makeBox(pnt1,pnt5) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") try : Box_13 = shaperpy.makeBox(None, pnt2) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the first point is not valid.") + assert(ec.what() == "Box builder with two points :: the first point is not valid.") try : Box_14 = shaperpy.makeBox(pnt2, None) except myExcept as ec: - assert(ec.what() == "Box builder with points :: the second point is not valid.") \ No newline at end of file + assert(ec.what() == "Box builder with two points :: the second point is not valid.") + +Box_15 = shaperpy.makeBox(0,0,0,10,10,10) \ No newline at end of file diff --git a/test.API/SHAPER/Primitives/TestBox.py b/test.API/SHAPER/Primitives/TestBox.py index 9dded65b0..f1d4b24d0 100644 --- a/test.API/SHAPER/Primitives/TestBox.py +++ b/test.API/SHAPER/Primitives/TestBox.py @@ -84,6 +84,7 @@ Box_15 = model.addBox(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine Box_16 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_2_1/To_Face]")) Box_17 = model.addBox(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1")) Box_18 = model.addBox(Part_1_doc, "dx", "dy", "dz") +Box_19 = model.addBox(Part_1_doc, 0, 0, 0, 20, 20 ,20) model.do() model.end() @@ -126,6 +127,12 @@ model.testNbSubShapes(Box_18, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Box_18, GeomAPI_Shape.FACE, [6]) model.testHaveNamingFaces(Box_18, model, Part_1_doc) +model.testNbResults(Box_19, 1) +model.testNbSubResults(Box_19, [0]) +model.testNbSubShapes(Box_19, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Box_19, GeomAPI_Shape.FACE, [6]) +model.testHaveNamingFaces(Box_19, model, Part_1_doc) + model.testNbResults(Box_2, 0) assert(Box_2.feature().error() == "Box builder with dimensions :: Dx is null or negative.") @@ -145,16 +152,17 @@ model.testNbResults(Box_7, 0) assert(Box_7.feature().error() == "Box builder with dimensions :: Dz is null or negative.") model.testNbResults(Box_9, 0) -assert(Box_9.feature().error() == "Box builder with points :: the distance between the two points is null.") +print (Box_9.feature().error()) +assert(Box_9.feature().error() == "Box builder with two points :: the distance between the two points is null.") model.testNbResults(Box_10, 0) -assert(Box_10.feature().error() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert(Box_10.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") model.testNbResults(Box_11, 0) -assert(Box_11.feature().error() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert(Box_11.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") model.testNbResults(Box_12, 0) -assert(Box_12.feature().error() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert(Box_12.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") model.testNbResults(Box_13, 0) assert(Box_13.feature().error() == "Attribute \"FirstPoint\" is not initialized.") -- 2.39.2