From: mpv Date: Wed, 14 Nov 2018 11:58:12 +0000 (+0300) Subject: Update unit-tests with the better naming names. X-Git-Tag: End2018~176 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5819f1698a736a364b7ee6fcd2a94d6a27df7216;p=modules%2Fshaper.git Update unit-tests with the better naming names. --- diff --git a/src/CollectionPlugin/CMakeLists.txt b/src/CollectionPlugin/CMakeLists.txt index 674ea7e08..d383ace11 100644 --- a/src/CollectionPlugin/CMakeLists.txt +++ b/src/CollectionPlugin/CMakeLists.txt @@ -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 index 000000000..6b0b69e1d --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupShareTopology.py @@ -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 +## + +# -*- 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) diff --git a/src/FeaturesPlugin/Test/Test2046.py b/src/FeaturesPlugin/Test/Test2046.py index 6d2642714..bb3cb3670 100644 --- a/src/FeaturesPlugin/Test/Test2046.py +++ b/src/FeaturesPlugin/Test/Test2046.py @@ -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() diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 94b844d2e..272cb7338 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -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) { diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.h b/src/ModelAPI/ModelAPI_AttributeSelectionList.h index 6f2cafb18..7bdd59a6b 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.h +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.h @@ -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& theSubShape, const bool theTemporarily = false) = 0; diff --git a/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py b/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py index c4a12d89f..a97c9cd77 100644 --- a/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py +++ b/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py @@ -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 diff --git a/src/ModelAPI/Test/TestSelectionScope.py b/src/ModelAPI/Test/TestSelectionScope.py index 0b9ed954d..f8a754dc8 100644 --- a/src/ModelAPI/Test/TestSelectionScope.py +++ b/src/ModelAPI/Test/TestSelectionScope.py @@ -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()