From bb35f30445789d765cdc106da40efb95cce7a41f Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 9 Apr 2019 16:14:51 +0300 Subject: [PATCH] Make unit tests work with the new validator checking --- src/BuildPlugin/Test/TestFace.py | 25 +++++++++++++++++++++++-- src/Model/Model_AttributeValidator.cpp | 3 +-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/BuildPlugin/Test/TestFace.py b/src/BuildPlugin/Test/TestFace.py index 47091eeb7..4ad935ab0 100644 --- a/src/BuildPlugin/Test/TestFace.py +++ b/src/BuildPlugin/Test/TestFace.py @@ -113,11 +113,21 @@ assert (len(aFaceFeature2.results()) > 0) # ============================================================================= # Test 3. Create face from face of solid # ============================================================================= +aSession.startOperation() +aCylinder = aPart.addFeature("Cylinder") +aCylinder.string("CreationMethod").setValue("Cylinder") +aCylinder.selection("base_point").selectSubShape("VERTEX", "PartSet/Origin") +aCylinder.selection("axis").selectSubShape("EDGE", "PartSet/OZ") +aCylinder.real("radius").setValue(5) +aCylinder.real("height").setValue(10) +aSession.finishOperation() +aCylinderResult = aCylinder.firstResult() +aCylinderShape = aCylinderResult.shape() aSession.startOperation() aFaceFeature3 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature3.selectionList("base_objects") -aBaseObjectsList.append("Cylinder_1_1/Face_1", "FACE") +aBaseObjectsList.append("Cylinder_2_1/Face_1", "FACE") aSession.finishOperation() assert (len(aFaceFeature3.results()) > 0) @@ -125,6 +135,17 @@ assert (len(aFaceFeature3.results()) > 0) # Test 4. Verify error is reported if selection of face feature is mixed (edges and face) # ============================================================================= +aSession.startOperation() +aCylinder = aPart.addFeature("Cylinder") +aCylinder.string("CreationMethod").setValue("Cylinder") +aCylinder.selection("base_point").selectSubShape("VERTEX", "PartSet/Origin") +aCylinder.selection("axis").selectSubShape("EDGE", "PartSet/OZ") +aCylinder.real("radius").setValue(5) +aCylinder.real("height").setValue(10) +aSession.finishOperation() +aCylinderResult = aCylinder.firstResult() +aCylinderShape = aCylinderResult.shape() + aSession.startOperation() aFaceFeature4 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature4.selectionList("base_objects") @@ -132,7 +153,7 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aSketchShape, GeomAPI_Shape.EDGE) while aShapeExplorer.more(): aBaseObjectsList.append(aSketchResult, aShapeExplorer.current()) aShapeExplorer.next() -aBaseObjectsList.append("Cylinder_1_1/Face_3", "FACE") +aBaseObjectsList.append("Cylinder_3_1/Face_3", "FACE") aSession.finishOperation() assert (len(aFaceFeature4.results()) == 0) # remove failed feature diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index 659082b05..ab0142814 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -123,8 +123,7 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, aCheckFeature = false; } else { aRefd = *aRefRes; - if (aRefd->groupName() != ModelAPI_ResultBody::group() && - aRefd->groupName() != ModelAPI_ResultPart::group()) + if (aRefd->groupName() != ModelAPI_ResultBody::group()) break; } if (!aRefd->data().get() || !aRefd->data()->isValid()) -- 2.39.2