From: azv Date: Mon, 17 Dec 2018 08:02:16 +0000 (+0300) Subject: [Code coverage GDMLAPI]: Improve coverage X-Git-Tag: End2018~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f1c51660913a3aefb658d2e45e05b22bdf4860a5;p=modules%2Fshaper.git [Code coverage GDMLAPI]: Improve coverage --- diff --git a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp index a68dab5b0..98be7b5e6 100644 --- a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp +++ b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp @@ -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; } diff --git a/src/GDMLPlugin/CMakeLists.txt b/src/GDMLPlugin/CMakeLists.txt index f2d4c1b6f..f6e40dbcf 100644 --- a/src/GDMLPlugin/CMakeLists.txt +++ b/src/GDMLPlugin/CMakeLists.txt @@ -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 index 000000000..10e440ba7 --- /dev/null +++ b/src/GDMLPlugin/Test/TestCone.py @@ -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 +## + +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 index 000000000..3f7080d20 --- /dev/null +++ b/src/GDMLPlugin/Test/TestEllipsoid.py @@ -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 +## + +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())