]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1648 : make unit tests for sketch more stable (null sub-features and order...
authormpv <mpv@opencascade.com>
Wed, 17 Aug 2016 07:12:37 +0000 (10:12 +0300)
committermpv <mpv@opencascade.com>
Wed, 17 Aug 2016 07:12:37 +0000 (10:12 +0300)
src/Model/Model_Objects.cpp
src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp
src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp
src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp
src/SketchPlugin/SketchPlugin_Feature.cpp

index 9484a1f4a793a6b88fd9997cd22415e8268dccab..f1edf57aac1a427ab90f77430dd4a4197015690b 100644 (file)
@@ -663,6 +663,11 @@ void Model_Objects::synchronizeFeatures(
       aFeature = myFeatures.Find(aFeatureLabel);
       aKeptFeatures.insert(aFeature);
       if (anUpdatedMap.Contains(aFeatureLabel)) {
+        if (!theOpen) { // on abort/undo/redo reinitialize attributes is something is changed
+          std::shared_ptr<Model_Data> aD = std::dynamic_pointer_cast<Model_Data>(aFeature->data());
+          aD->myAttrs.clear();
+          aFeature->initAttributes();
+        }
         ModelAPI_EventCreator::get()->sendUpdated(aFeature, anUpdateEvent);
         if (aFeature->getKind() == "Parameter") { // if parameters are changed, update the results (issue 937)
           const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
index 917af05babfd456423181a548f98a10ce0257dea..f45f90017fcb98620c307b6c01fc393e35f02749 100644 (file)
@@ -187,16 +187,23 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
   } else if (aType == ModelAPI_AttributeRefList::typeId()) {
     AttributeRefListPtr anAttr = 
       std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttr);
+    // for sketch sub-features the empty values may be skipped and order is not important
+    bool isSketchFeatures = anAttr->id() == "Features" && 
+      std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->owner())->getKind() == "Sketch";
     std::list<ObjectPtr> aList = anAttr->list();
+    std::list<std::string> aResList; // list of resulting strings
     for(std::list<ObjectPtr>::iterator aL = aList.begin(); aL != aList.end(); aL++) {
-      if (aL != aList.begin())
-        aResult<<" ";
       if (aL->get()) {
-        aResult<<(*aL)->data()->name();
-      } else {
-        aResult<<"__empty__";
+        aResList.push_back((*aL)->data()->name());
+      } else if (!isSketchFeatures) {
+        aResList.push_back("__empty__");
       }
     }
+    if (isSketchFeatures)
+      aResList.sort();
+    for(std::list<std::string>::iterator aR = aResList.begin(); aR != aResList.end(); aR++) {
+      aResult<<*aR<<" ";
+    }
   } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
     AttributeRefAttrListPtr anAttr = 
       std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttr);
index 530895f30d1f68e7d934e886ad70b813bd292161..0481c4a14a0f48e193f4ac149edd4563b978d87f 100644 (file)
@@ -13,7 +13,6 @@
 #include <GeomAPI_XY.h>
 #include <GeomDataAPI_Point2D.h>
 #include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeRefAttrList.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Events.h>
index 4e6cdfd62a6f7d5f0d5135cb61ba451ff4c9cb49..e53185f413b11ceb49bbbf5e3a36e75866733a02 100755 (executable)
@@ -6,16 +6,10 @@
 
 #include "SketchPlugin_ConstraintSplit.h"
 
-//#include <GeomAPI_Circ2d.h>
-//#include <GeomAPI_Dir2d.h>
-//#include <GeomAPI_Lin2d.h>
 #include <GeomAPI_Pnt2d.h>
-//#include <GeomAPI_XY.h>
 #include <GeomDataAPI_Point2D.h>
-//#include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeString.h>
-//#include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_Tools.h>
 
index 5842df8a0968939413d98fd409be090d7e116fa9..436cc5e7b428110a780758741702818af822ec83 100644 (file)
@@ -5,7 +5,6 @@
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
-#include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_ResultConstruction.h>
 
 /// It is important.