From: Nicolas RECHATIN Date: Fri, 23 Jul 2021 13:43:32 +0000 (+0200) Subject: test addVolume test : TestAddVolume.py X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e6085753ca2bdfaf5e6461ab33c74be7fae9726b;p=modules%2Fshaper.git test addVolume test : TestAddVolume.py --- diff --git a/src/OperaPlugin/Test/TestAddVolume.py b/src/OperaPlugin/Test/TestAddVolume.py index c696b8fc7..a8b70d72c 100644 --- a/src/OperaPlugin/Test/TestAddVolume.py +++ b/src/OperaPlugin/Test/TestAddVolume.py @@ -18,47 +18,63 @@ # """ - TestBoolean.py - Unit test of FeaturesPlugin_Group class - - class FeaturesPlugin_Group - static const std::string MY_GROUP_ID("Group"); - static const std::string MY_GROUP_LIST_ID("group_list"); - - data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + TestAddVolume.py + Test case of OperaPlugin_addVolume """ #========================================================================= # Initialization of the test #========================================================================= +from salome.shaper import model -#========================================================================= -# Create a Box -#========================================================================= - -#========================================================================= -# Create a Torus -#========================================================================= +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() #========================================================================= -# Create a Cylinder +# Create a Box, a Torus and a Cylinder #========================================================================= +Box_1 = model.addBox(Part_1_doc, 10, 20, 10) +Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) #========================================================================= # Create one Volume #========================================================================= +Volume_1 = model.addVolume(Part_1_doc, "Test_medium", [model.selection("SOLID", "Box_1")]) + #========================================================================= # Check results #========================================================================= +from GeomAPI import GeomAPI_Shape + +# TODO : Check this +# TODO : Do I need a testNbVolume ?? +model.testNbResults(Volume_1, 1) +model.testNbSubResults(Volume_1, [0]) +model.testNbSubShapes(Volume_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Volume_1, GeomAPI_Shape.FACE, [6]) +model.testHaveNamingFaces(Volume_1, model, Part_1_doc) + #========================================================================= # Create two volumes at once #========================================================================= +Volume_2 = model.addVolume(Part_1_doc, "Test_medium_2", [model.selection("SOLID", "Torus_1"), + model.selection("SOLID", "Cylinder_1")]) + #========================================================================= # Check results #========================================================================= +# TODO : Check this + +model.testNbResults(Volume_2, 2) +model.testNbSubResults(Volume_2, [0]) +model.testNbSubShapes(Volume_2, GeomAPI_Shape.SOLID, [2]) + #========================================================================= # End of test #=========================================================================