]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the problem of the nightly unit-tests performance.
authormpv <mpv@opencascade.com>
Mon, 14 Oct 2019 12:22:36 +0000 (15:22 +0300)
committermpv <mpv@opencascade.com>
Mon, 14 Oct 2019 12:22:36 +0000 (15:22 +0300)
src/CollectionPlugin/CMakeLists.txt
src/CollectionPlugin/Test/TestGroupMove26.py [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_Recover.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/PythonAddons/macros/compoundVertices/feature.py
src/XGUI/XGUI_Workshop.cpp

index 4da31a3179296ff1e3b4b3793ef03c4621b3d71b..619c42de6284887177ffd626120824aadfd20f31 100644 (file)
@@ -143,6 +143,7 @@ ADD_UNIT_TESTS(
                TestGroupMove23.py
                TestGroupMove24.py
                TestGroupMove25.py
+               TestGroupMove26.py
                TestGroupShareTopology.py
                TestGroupAddition.py
                TestGroupAddition_Error.py
diff --git a/src/CollectionPlugin/Test/TestGroupMove26.py b/src/CollectionPlugin/Test/TestGroupMove26.py
new file mode 100644 (file)
index 0000000..14bd39a
--- /dev/null
@@ -0,0 +1,46 @@
+# Copyright (C) 2014-2019  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
+#
+
+# Check that if particular result of group is concealed, other results are not concealed
+# and don't treated like that by the move to the history algorithm
+
+from salome.shaper import model
+from ModelAPI import *
+
+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("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(10.07512315270936, 19.52832512315271, 5.646825151450413)
+SketchCircle_2 = Sketch_1.addCircle(-17.04064039408868, -4.229064039408867, 10.0065552781921)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1")])
+RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+Part_1_doc.moveFeature(Group_1.feature(), RemoveResults_1.feature())
+model.end()
+
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Group_1.feature()))
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 1)
+
+assert(model.checkPythonDump())
index bae08ab42a3bece6b30781e23ecec49bdceaf4e6..9082ea1684e52a6cc5d77e15f4de911fba3f2fa9 100644 (file)
@@ -46,7 +46,9 @@ void FeaturesPlugin_Recover::initAttributes()
   data()->addAttribute(METHOD(), ModelAPI_AttributeString::typeId());
   if (!string(METHOD())->isInitialized()) {
     myClearListOnTypeChange = false;
+    data()->blockSendAttributeUpdated(true, false);
     string(METHOD())->setValue(METHOD_DEFAULT());
+    data()->blockSendAttributeUpdated(false, false);
     myClearListOnTypeChange = true;
   }
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), METHOD());
index c985315b41dff61020b9533ef23bc5452e840e85..d636a3804608ac6af36832320f5e6dab92f3bbdc 100644 (file)
@@ -1282,14 +1282,21 @@ void Model_AttributeSelection::computeValues(
 
 
 void Model_AttributeSelection::concealedFeature(
-  const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers)
+  const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers,
+  const ResultPtr theResultOfFeature)
 {
   std::set<FeaturePtr> alreadyProcessed;
   alreadyProcessed.insert(theFeature);
   if (theStop.get())
     alreadyProcessed.insert(theStop);
   /// iterate all results to find the concealment-attribute
-  const std::list<ResultPtr>& aRootRes = theFeature->results();
+  std::list<ResultPtr> aRootRes;
+  if (theResultOfFeature.get()) {
+    ResultPtr aRoot = ModelAPI_Tools::bodyOwner(theResultOfFeature, true);
+    aRootRes.push_back(aRoot ? aRoot : theResultOfFeature);
+  } else { // all results of a feature
+   aRootRes = theFeature->results();
+  }
   std::list<ResultPtr>::const_iterator aRootIter = aRootRes.cbegin();
   for(; aRootIter != aRootRes.cend(); aRootIter++) {
     std::list<ResultPtr> allRes;
@@ -1398,7 +1405,7 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr<Model_Document>
     FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
     FeaturePtr aContextOwner = theDoc->feature(theContext);
     std::list<FeaturePtr> aConcealers;
-    concealedFeature(aContextOwner, aThisFeature, aConcealers);
+    concealedFeature(aContextOwner, aThisFeature, aConcealers, theContext);
     std::list<FeaturePtr>::iterator aConcealer = aConcealers.begin();
     for(; aConcealer != aConcealers.end(); aConcealer++) {
       std::list<ResultPtr> aRefResults;
@@ -1471,7 +1478,7 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove)
       if (aFeature.get()) {
         FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
         std::list<FeaturePtr> aConcealers;
-        concealedFeature(aFeature, aThisFeature, aConcealers);
+        concealedFeature(aFeature, aThisFeature, aConcealers, ResultPtr());
         if (aConcealers.empty())
           return;
         bool aChanged = false;
index b7d81ff7406ac5020a369478aa026620c4ec65a2..bd26925b3fd229cac2ab96282b2d645a01fa4407 100644 (file)
@@ -203,8 +203,10 @@ protected:
   TDF_Label baseDocumentLab();
 
   /// Returns features that conceals theFeature and located in history before theStop
+  /// theResultOfFeature if not null defines exact referenced result of a feature
   void concealedFeature(
-    const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers);
+    const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers,
+    const ResultPtr theResultOfFeature);
 
   friend class Model_Data;
   friend class Model_AttributeSelectionList;
index 492594c4ae9eeec0d028f93159e55c388e70f570..ba0a1492176ff7d08bf747d98e75c2736e77239a 100644 (file)
@@ -2,7 +2,6 @@
 Author: Nathalie Gore
 """
 
-from qtsalome import QMessageBox
 from salome.shaper import model
 from salome.shaper import geom
 import ModelAPI
@@ -79,7 +78,6 @@ class compoundVertices(model.Feature):
                 for line in file:
                     coord = line.split(self.separator)
                     if len(coord) != 3:
-                        #QMessageBox.warning( self, 'Error!', '3D coords waited!' )
                         return
                     x = float(coord[0]); y = float(coord[1]); z = float(coord[2]);
                     point = model.addPoint(part, x,y,z); point.execute(True); self.lfeatures.append(point)
index ed7de14923afe69e69c5d8811679a1f264f26498..3e552186df412c9db79d1f4484239e18c2992397 100644 (file)
@@ -1816,17 +1816,19 @@ void XGUI_Workshop::deleteObjects()
   if (!(hasResult || hasFeature || hasParameter || hasFolder))
     return;
 
-  // Remove from the list non-deletable objects: infinite constuctions which are not in history
+  // Remove from the list non-deletable objects: infinite constructions which are not in history
   bool notDelete = true;
   QObjectPtrList::iterator aIt;
   for (aIt = anObjects.begin(); aIt != anObjects.end(); aIt++) {
     ObjectPtr aObj = (*aIt);
     ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
     FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
-    notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
-    if (notDelete) {
-      anObjects.removeAll(aObj);
-      aIt--;
+    if (aFeature) {
+      notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
+      if (notDelete) {
+        anObjects.removeAll(aObj);
+        aIt--;
+      }
     }
   }
   // delete objects