Salome HOME
Added a unit-test for #21537 : Dumped file not loadable
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 4 Jun 2020 12:47:24 +0000 (15:47 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 4 Jun 2020 12:47:24 +0000 (15:47 +0300)
src/Model/Model_AttributeSelection.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/Test/Test19217.py [new file with mode: 0644]

index 3badb0068c7bd854780f450434620d2320b29ff2..27ef884adca2e21cc522a4fd07ef4f9cabf8e303 100644 (file)
@@ -2098,10 +2098,9 @@ ResultPtr Model_AttributeSelection::newestContext(
       }
     }
   }
-  // in case sketch line was selected for wire, but wire was concealed and not such line anymore,
-  // so, actually, the sketch element was selected (which is never concealed)
+  // in case sketch line was selected for wire, but wire was concealed and there is no such line
+  // anymore, so, actually, the sketch element was selected (which is never concealed)
   if (aResult != theCurrent && theCurrent->groupName() == ModelAPI_ResultConstruction::group()) {
-    //&& aResult->isConcealed())
     std::list<FeaturePtr> aConcealers;
     FeaturePtr aResFeature = aDoc->feature(aResult);
     FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
index 19ad06cf76a5828234644186d2b0542c9777bb2b..461b1aa2e43e1dfc32c7135642ac73fd8979860d 100644 (file)
@@ -259,4 +259,5 @@ ADD_UNIT_TESTS(TestConstants.py
                Test19019_2.py
                Test19031.py
                Test19058.py
+               Test19217.py
 )
diff --git a/src/ModelAPI/Test/Test19217.py b/src/ModelAPI/Test/Test19217.py
new file mode 100644 (file)
index 0000000..b85b013
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright (C) 2014-2020  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
+#
+
+# Test if the Model_AttributeSelection::newestContext method work in case
+# the initial shell is concealed by multi-rotation (all-feature selection)
+# and the same sketch is used by a next shell.
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchCircle_1 = Sketch_1.addCircle(47.53111880904039, 63.23707920074999, 11.27757708463696)
+model.do()
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Shell_1")], model.selection("EDGE", "PartSet/OZ"), 3, keepSubResults = True)
+Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
+model.end()
+
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Shell_2.feature()))
+
+assert(model.checkPythonDump())
\ No newline at end of file