From a5560f9b9c5cc8e8f48522b5992539518733a6d3 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 22 Jun 2016 17:55:58 +0300 Subject: [PATCH] Fix for the import XAO unit test --- src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp | 11 ++--------- src/ExchangePlugin/Test/TestImport.py | 4 +--- src/Model/Model_Update.cpp | 9 ++++++--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 4060c3e04..d5eaf2360 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -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 ExchangePlugin_ImportFeature::subFeature( diff --git a/src/ExchangePlugin/Test/TestImport.py b/src/ExchangePlugin/Test/TestImport.py index 77ed65b21..6b986c272 100644 --- a/src/ExchangePlugin/Test/TestImport.py +++ b/src/ExchangePlugin/Test/TestImport.py @@ -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 #========================================================================= diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 52cf1d1ba..1f6c8319f 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -486,9 +486,12 @@ bool Model_Update::processFeature(FeaturePtr theFeature) isPostponedMain = aCurrentOwner.get() && aCompos->isSub(aCurrentOwner); } - #ifdef DEB_UPDATE - std::cout<<"Update args "<name()<name()<data()->isValid()) + return false; // Update selection and parameters attributes first, before sub-features analysis (sketch plane). updateArguments(theFeature); -- 2.39.2