]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[Code coverage GeomAlgoAPI]: Increase coverage of NExplode algorithm
authorazv <azv@opencascade.com>
Thu, 20 Dec 2018 07:34:52 +0000 (10:34 +0300)
committerazv <azv@opencascade.com>
Thu, 20 Dec 2018 07:34:52 +0000 (10:34 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/Test/TestWeakNamingSortOrder.py [new file with mode: 0644]

index 392ac4c4c85dab9d2012ba99eaec6621006b7c8e..01d9fe69241329517fe3c1bd76962ed8f5a30f72 100644 (file)
@@ -124,10 +124,12 @@ bool CompareShapes::operator() (const TopoDS_Shape& theShape1,
           if ((val1 - val2) >= tol) {
             exchange = Standard_True;
           }
+          else // compare adresses if shapes are geometrically equal
+            exchange = theShape1.TShape().get() > theShape2.TShape().get();
         }
       }
     } else // compare adresses if shapes are geometrically equal
-      return theShape1.TShape().get() > theShape2.TShape().get();
+      exchange = theShape1.TShape().get() > theShape2.TShape().get();
   }
 
   //return val1 < val2;
index 49ffb66457bc414917f11c7d1e2a1d8de89f3615..71a3e37a6d62c9eca273bf5af72b77e756b0a2d9 100644 (file)
@@ -226,6 +226,7 @@ ADD_UNIT_TESTS(TestConstants.py
                TestWeakNaming2445.py
                TestWeakNaming2446.py
                TestWeakNaming2452.py
+               TestWeakNamingSortOrder.py
                Test2685.py
                TestGeomNamingPlacement.py
                TestGeomNamingRevolution.py
diff --git a/src/ModelAPI/Test/TestWeakNamingSortOrder.py b/src/ModelAPI/Test/TestWeakNamingSortOrder.py
new file mode 100644 (file)
index 0000000..73c53e4
--- /dev/null
@@ -0,0 +1,103 @@
+## 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 *
+
+model.begin()
+partSet = model.moduleDocument()
+
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
+Point_3 = model.addPoint(Part_1_doc, 0, 10, 0)
+Point_4 = model.addPoint(Part_1_doc, 20, 10, 0)
+Point_5 = model.addPoint(Part_1_doc, 10, 20, 0)
+Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_4")], False)
+Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")], False)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Polyline_1_1"), model.selection("WIRE", "Polyline_2_1")])
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2", 1)], model.selection("EDGE", "PartSet/OY"), 10)
+model.do()
+
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [2])
+model.testResultsVolumes(Translation_1, [0])
+
+
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
+Box_2 = model.addBox(Part_2_doc, 4, 4, 4)
+Translation_2 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
+Compound_2 = model.addCompound(Part_2_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")])
+Translation_3 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Compound_1_1", 0)], 10, 0, 0)
+model.do()
+
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [2])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [12])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [48])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [96])
+model.testResultsVolumes(Translation_3, [1064])
+
+
+Part_3 = model.addPart(partSet)
+Part_3_doc = Part_3.document()
+Box_3 = model.addBox(Part_3_doc, 10, 10, 10)
+Box_4 = model.addBox(Part_3_doc, 10, 10, 10)
+Point_6 = model.addPoint(Part_3_doc, 5, 5, 0)
+Point_7 = model.addPoint(Part_3_doc, 5, 5, 10)
+Axis_4 = model.addAxis(Part_3_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"))
+Rotation_1 = model.addRotation(Part_3_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "Axis_1"), 45)
+Compound_3 = model.addCompound(Part_3_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")])
+Translation_4 = model.addTranslation(Part_3_doc, [model.selection("SOLID", "Compound_1_1", 1)], 10, 0, 0)
+model.do()
+
+model.testNbResults(Translation_4, 1)
+model.testNbSubResults(Translation_4, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_4, [1000])
+
+
+Part_4 = model.addPart(partSet)
+Part_4_doc = Part_4.document()
+Box_5 = model.addBox(Part_4_doc, 10, 10, 10)
+Box_6 = model.addBox(Part_4_doc, 10, 10, 10)
+Compound_4 = model.addCompound(Part_4_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
+Translation_5 = model.addTranslation(Part_4_doc, [model.selection("SOLID", "Compound_1_1", 1)], model.selection("EDGE", "PartSet/OZ"), 10)
+model.do()
+
+model.testNbResults(Translation_5, 1)
+model.testNbSubResults(Translation_5, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_5, [1000])
+
+model.end()