From 6a1577e598a99ab41c52ab59b9126de648208028 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 9 Apr 2019 17:57:16 +0300 Subject: [PATCH] For the issue #2903 : make only latest feature become invalid because of python scripts execution specifics --- src/Model/Model_AttributeValidator.cpp | 10 +++++++--- src/ModelAPI/Test/Test2903.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index ab0142814..135a6a423 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -136,9 +136,13 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, continue; if (ModelAPI_Session::get()->validators()->isConcealed( aRefFeat->getKind(), (*aRR)->id())) { - theError = "Reference to concealed object %1"; - theError.arg(aRefd->data()->name()); - return false; + // check this feature is later than another referenced to make unit tests working + //because of Test1757 and others: allow to move selection context of this to next + if (aFeat->document()->isLater(aFeat, aRefFeat)) { + theError = "Reference to concealed object %1"; + theError.arg(aRefd->data()->name()); + return false; + } } } if (aCheckFeature) diff --git a/src/ModelAPI/Test/Test2903.py b/src/ModelAPI/Test/Test2903.py index b97b1e6c1..c66ce71ef 100644 --- a/src/ModelAPI/Test/Test2903.py +++ b/src/ModelAPI/Test/Test2903.py @@ -36,6 +36,6 @@ assert(aFactory.validate(Partition_1.feature())) # Modify Fuse to add sphere thatwas used in Partition Fuse_1.setMainObjects([model.selection("COMPOUND", "all-in-Box_1"), model.selection("COMPOUND", "all-in-Cylinder_1"), model.selection("COMPOUND", "all-in-Sphere_1")]) model.end() -# both fuse and partition must become invalid because both refer to the same object +# partition must become invalid because it refers to the same object as fuse assert(not aFactory.validate(Fuse_1.feature())) -assert(not aFactory.validate(Partition_1.feature())) +assert(aFactory.validate(Partition_1.feature())) -- 2.30.2