]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the import XAO unit test
authormpv <mpv@opencascade.com>
Wed, 22 Jun 2016 14:55:58 +0000 (17:55 +0300)
committermpv <mpv@opencascade.com>
Wed, 22 Jun 2016 14:55:58 +0000 (17:55 +0300)
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp
src/ExchangePlugin/Test/TestImport.py
src/Model/Model_Update.cpp

index 4060c3e0495948dfdeb3be2f51009fa93c1963e6..d5eaf23603fbf028461b5a8a289d1b9f2995b5cf 100644 (file)
@@ -213,19 +213,12 @@ void ExchangePlugin_ImportFeature::removeFeature(
   if (!data()->isValid())
     return;
   AttributeRefListPtr aList = reflist(FEATURES_ID());
-  // if the object is last, remove it from the list (needed to skip empty transaction on edit of sketch feature)
-  if (aList->object(aList->size(true) - 1, true) == theFeature) {
-    aList->remove(theFeature);
-  } else {
-    // to keep the persistent sub-elements indexing, do not remove elements from list,
-    // but substitute by nulls
-    aList->substitute(theFeature, ObjectPtr());
-  }
+  aList->remove(theFeature);
 }
 
 int ExchangePlugin_ImportFeature::numberOfSubs(bool forTree) const
 {
-  return data()->reflist(FEATURES_ID())->size(false);
+  return data()->reflist(FEATURES_ID())->size(true);
 }
 
 std::shared_ptr<ModelAPI_Feature> ExchangePlugin_ImportFeature::subFeature(
index 77ed65b21c7ab41428962af9687bf556b30126f8..6b986c2727f34761d3bcff1db69e884c7ed572e4 100644 (file)
@@ -33,7 +33,6 @@ def testImport(theType, theFile, theVolume, theDelta):
     file = anImportFeature.string(aFieldName)
     assert file, "{0}: Can not receive string field {1}".format(theType, aFieldName)
     file.setValue(theFile)
-    anImportFeature.execute()
     aSession.finishOperation()
 
     # Check results
@@ -59,7 +58,6 @@ def testImportXAO():
     aSession.startOperation("Import XAO")
     anImportFeature = aPart.addFeature("Import")
     anImportFeature.string("file_path").setValue("Data/test.xao")
-    anImportFeature.execute()
     aSession.finishOperation()
 
     # Check results
@@ -109,7 +107,7 @@ if __name__ == '__main__':
 #=========================================================================
 # Create a shape imported from XAO
 #=========================================================================
-    testImportXAO()
+    testImportXAO()
 #=========================================================================
 # End of test
 #=========================================================================
index 52cf1d1ba4ee5167763fb2eefaeec423437508fb..1f6c8319f6e7950e42d4505e79a2bafee60ca786 100755 (executable)
@@ -486,9 +486,12 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
     isPostponedMain = aCurrentOwner.get() && aCompos->isSub(aCurrentOwner);
   }
 
-  #ifdef DEB_UPDATE
-    std::cout<<"Update args "<<theFeature->name()<<std::endl;
-  #endif
+#ifdef DEB_UPDATE
+  std::cout<<"Update args "<<theFeature->name()<<std::endl;
+#endif
+  // TestImport.py : after arguments are updated, theFeature may be removed
+  if (!theFeature->data()->isValid())
+    return false;
   // Update selection and parameters attributes first, before sub-features analysis (sketch plane).
   updateArguments(theFeature);