]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update unit-tests with the better naming names.
authormpv <mpv@opencascade.com>
Wed, 14 Nov 2018 11:58:12 +0000 (14:58 +0300)
committermpv <mpv@opencascade.com>
Wed, 14 Nov 2018 11:58:12 +0000 (14:58 +0300)
src/CollectionPlugin/CMakeLists.txt
src/CollectionPlugin/Test/TestGroupShareTopology.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2046.py
src/Model/Model_ResultConstruction.cpp
src/ModelAPI/ModelAPI_AttributeSelectionList.h
src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py
src/ModelAPI/Test/TestSelectionScope.py

index 674ea7e083acd72af5fce5378bfa0a70f9553283..d383ace114368b75e2831039c10583e96cd3338a 100644 (file)
@@ -109,4 +109,5 @@ ADD_UNIT_TESTS(
                TestGroup1799.py
                TestGroupMove.py
                TestGroupMove2.py
+               TestGroupShareTopology.py
 )
diff --git a/src/CollectionPlugin/Test/TestGroupShareTopology.py b/src/CollectionPlugin/Test/TestGroupShareTopology.py
new file mode 100644 (file)
index 0000000..6b0b69e
--- /dev/null
@@ -0,0 +1,51 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# -*- coding: utf-8 -*-
+
+from GeomAPI import *
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 3, [model.selection("SOLID", "Box_1_1")])
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.69238908106919, 4.989364948318125, 5.746414396356567)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Top&weak_name_1")])
+model.do()
+# enable geometrical selection mode => 4 faces must be selected as one compound
+Group_1.groupList().setGeometricalSelection(True)
+model.do()
+assert(Group_1.groupList().size() == 1)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.COMPOUND)
+
+# disable geometrical selection mode => 4 faces must be selected as 4 group elements
+Group_1.groupList().setGeometricalSelection(False)
+model.end()
+
+assert(Group_1.groupList().size() == 4)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(1).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(2).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(3).value().shapeType() == GeomAPI_Shape.FACE)
index 6d2642714ba36b0812a418b1049907fec74ab3bd..bb3cb3670489d3637c1fa631c22f171834a68c4a 100644 (file)
@@ -36,7 +36,7 @@ Part_1_doc = Part_1.document()
 Wire_1_objects = [model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3")]
 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0)
-Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&weak_name_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&weak_name_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&weak_name_3")]
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 model.do()
 model.end()
index 94b844d2e8a6ebddfe30a353a4e3668bab63e7f0..272cb7338a24527bc298cd3b8807e42d9544fce8 100644 (file)
@@ -55,7 +55,6 @@ Standard_GUID kIS_INFINITE("dea8cc5a-53f2-49c1-94e8-a947bed20a9f");
 // identifier of the result not in history
 Standard_GUID kIS_IN_HISTORY("a9aec01c-805e-44d1-b5d2-a63f06522f8a");
 
-
 void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName,
                                        std::string& theDefault)
 {
index 6f2cafb187c924e9893c15211c4bd1c02cb7ba4b..7bdd59a6bef1723ed77e78b7bbbc7deb7268826a 100644 (file)
@@ -74,7 +74,7 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, it checks also the temporary added item
-  /// \returns true if the pair is found in the attirbute
+  /// \returns true if the pair is found in the attribute
   virtual bool isInList(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false) = 0;
index c4a12d89fc6116c12ace9086ef06d1b21f8238eb..a97c9cd77862fa952f19082506f3ae650cc5976b 100644 (file)
@@ -39,7 +39,7 @@ Box_2 = model.addBox(Part_1_doc, 2, 2, 10)
 Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("FACE", "Box_2_1/Bottom"), model.selection("FACE", "_weak_name_4_Partition_1_1_14"), False, True)
 model.do()
 # update the selection of the placement
-Placement_1.setEndShape(model.selection("EDGE", "[_weak_name_4_Partition_1_1_5][(Partition_1_1_5/Modified_Face&Box_1_1/Back)2]"))
+Placement_1.setEndShape(model.selection("EDGE", "Partition_1_1_5/Generated_Edge&Plane_3/Plane_3&Plane_2/Plane_2"))
 model.end()
 
 # check that placement is valid
index 0b9ed954da3e0c7c5ef6f83010efe7a2e5c4c1fa..f8a754dc8038c712f71aba880eab5f63d8e7bf4d 100644 (file)
@@ -74,7 +74,7 @@ lenParam.setValue(100)
 Part_1_doc.setCurrentFeature(Cylinder_2.feature(), True)
 model.do()
 # update selection of cylinder base points
-model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face&weak_name_1]").fillAttribute(Cylinder_1.basePoint())
+model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)]").fillAttribute(Cylinder_1.basePoint())
 model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face&weak_name_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]").fillAttribute(Cylinder_2.basePoint())
 model.end()