]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[Code coverage GDMLAPI]: Improve coverage
authorazv <azv@opencascade.com>
Mon, 17 Dec 2018 08:02:16 +0000 (11:02 +0300)
committerazv <azv@opencascade.com>
Tue, 18 Dec 2018 04:24:16 +0000 (07:24 +0300)
src/GDMLAPI/GDMLAPI_ConeSegment.cpp
src/GDMLPlugin/CMakeLists.txt
src/GDMLPlugin/Test/TestCone.py [new file with mode: 0644]
src/GDMLPlugin/Test/TestEllipsoid.py [new file with mode: 0644]

index a68dab5b016da4210e9322f5b756ed2ad2a6e6d4..98be7b5e6e74c0e4b99cd84fc2b37101a3d5d295 100644 (file)
@@ -87,7 +87,7 @@ void GDMLAPI_ConeSegment::dump(ModelHighAPI_Dumper& theDumper) const
   AttributeDoublePtr anAttrDeltaPhi = aBase->real(GDMLPlugin_ConeSegment::DELTAPHI_ID());
   theDumper << ", " << anAttrRMin1 << ", " << anAttrRMax1;
   theDumper << ", " << anAttrRMin2 << ", " << anAttrRMax2;
-  theDumper << ", " << anAttrZ << ", " << anAttrStartPhi << " , " << anAttrDeltaPhi;
+  theDumper << ", " << anAttrZ << ", " << anAttrStartPhi << ", " << anAttrDeltaPhi;
 
   theDumper << ")" << std::endl;
 }
index f2d4c1b6f0c2609c5514769e0254d86f0e3759b3..f6e40dbcfb1fa2b26bb330dede360b5a0758bc27 100644 (file)
@@ -70,5 +70,7 @@ INSTALL(TARGETS GDMLPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
 INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/GDML)
 
-ADD_UNIT_TESTS()
-
+ADD_UNIT_TESTS(
+  TestCone.py
+  TestEllipsoid.py
+)
diff --git a/src/GDMLPlugin/Test/TestCone.py b/src/GDMLPlugin/Test/TestCone.py
new file mode 100644 (file)
index 0000000..10e440b
--- /dev/null
@@ -0,0 +1,39 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+ConeSegment_1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0, 270)
+model.end()
+
+model.testNbResults(ConeSegment_1, 1)
+model.testNbSubResults(ConeSegment_1, [0])
+model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(ConeSegment_1, [1545.663585663386584201361984015])
+
+assert(model.checkPythonDump())
diff --git a/src/GDMLPlugin/Test/TestEllipsoid.py b/src/GDMLPlugin/Test/TestEllipsoid.py
new file mode 100644 (file)
index 0000000..3f7080d
--- /dev/null
@@ -0,0 +1,79 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Ellipsoid_1 = model.addEllipsoid(Part_1_doc, 10, 20, 40)
+
+model.testNbResults(Ellipsoid_1, 1)
+model.testNbSubResults(Ellipsoid_1, [0])
+model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Ellipsoid_1, [4188.80255909031])
+
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Ellipsoid_2 = model.addEllipsoid(Part_2_doc, 20, 10, 30, 5, 5)
+
+model.testNbResults(Ellipsoid_2, 1)
+model.testNbSubResults(Ellipsoid_2, [0])
+model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Ellipsoid_2, [1512.62177363772])
+
+Part_3 = model.addPart(partSet)
+Part_3_doc = Part_3.document()
+Ellipsoid_3 = model.addEllipsoid(Part_3_doc, 20, 20, 40)
+Ellipsoid_3.setZCut1(5)
+
+model.testNbResults(Ellipsoid_3, 1)
+model.testNbSubResults(Ellipsoid_3, [0])
+model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.EDGE, [7])
+model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.VERTEX, [14])
+model.testResultsVolumes(Ellipsoid_3, [5726.87643051263])
+
+Part_4 = model.addPart(partSet)
+Part_4_doc = Part_4.document()
+Ellipsoid_4 = model.addEllipsoid(Part_4_doc, 20, 20, 40)
+Ellipsoid_4.setZCut2(5)
+
+model.testNbResults(Ellipsoid_4, 1)
+model.testNbSubResults(Ellipsoid_4, [0])
+model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.EDGE, [7])
+model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.VERTEX, [14])
+model.testResultsVolumes(Ellipsoid_4, [5726.87643051263])
+
+model.end()
+
+assert(model.checkPythonDump())