From 3f235c313a5ab565dc78e01b2742808abe6100df Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 8 Nov 2018 16:53:56 +0300 Subject: [PATCH] Fix small issues found by regressions in unit tests --- src/BuildPlugin/Test/TestInterpolation.py | 2 +- src/BuildPlugin/Test/TestWire.py | 2 +- src/Model/Model_AttributeSelection.cpp | 17 +++++++---------- src/ModelHighAPI/ModelHighAPI_Tools.cpp | 2 +- test.models/plug.py | 7 ------- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/BuildPlugin/Test/TestInterpolation.py b/src/BuildPlugin/Test/TestInterpolation.py index ddde2e509..b3d868444 100644 --- a/src/BuildPlugin/Test/TestInterpolation.py +++ b/src/BuildPlugin/Test/TestInterpolation.py @@ -175,4 +175,4 @@ model.end() # ============================================================================= # Test 12. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) diff --git a/src/BuildPlugin/Test/TestWire.py b/src/BuildPlugin/Test/TestWire.py index 5b9fdfc54..a48990443 100644 --- a/src/BuildPlugin/Test/TestWire.py +++ b/src/BuildPlugin/Test/TestWire.py @@ -177,4 +177,4 @@ aSession.startOperation() aPart.removeFeature(aWireFeature3) aSession.finishOperation() -assert(model.checkPythonDump()) +assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 77f6bb5fa..90e39662b 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -934,25 +934,22 @@ void Model_AttributeSelection::selectSubShape( aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelectorShape)); // make the context result the latest existing aContext = newestContext(aContext, aShapeToBeSelected); - if (myIsGeometricalSelection) { // store the currently generated name + if (myIsGeometricalSelection || aCenterType == NOT_CENTER) { // store the currently generated name selectionLabel().ForgetAllAttributes(true); bool aToUnblock = false; aToUnblock = !owner()->data()->blockSendAttributeUpdated(true); myRef.setValue(aContext); aSelector.store(); + aSelector.solve(aContextShape); owner()->data()->sendAttributeUpdated(this); if (aToUnblock) owner()->data()->blockSendAttributeUpdated(false); return; - } else { // re-select by context and value - if (aCenterType != NOT_CENTER) { - if (!aShapeToBeSelected->isEdge()) - continue; - std::shared_ptr aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected)); - setValueCenter(aContext, aSelectedEdge, aCenterType); - } - else - setValue(aContext, aShapeToBeSelected); + } else { // re-select center of circle/arc by context and value + if (!aShapeToBeSelected->isEdge()) + continue; + std::shared_ptr aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected)); + setValueCenter(aContext, aSelectedEdge, aCenterType); } return; } diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index a8a2ffcf3..d658206b4 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -548,7 +548,7 @@ bool checkPythonDump(const checkDumpType theCheckType) return false; } - bool isOk; + bool isOk = true; if (theCheckType & CHECK_NAMING) { // check dump with the selection by names isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming); diff --git a/test.models/plug.py b/test.models/plug.py index 8915f5316..b390aced6 100644 --- a/test.models/plug.py +++ b/test.models/plug.py @@ -437,11 +437,6 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [366]) model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [732]) model.testResultsVolumes(Result, [14144.443128843522572424262762070]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "(Plug/Modified_Face&Sketch_1/SketchLine_4)(Plug/Modified_Face&Sketch_2/SketchCircle_1_2)(Plug/Modified_Face&Sketch_1/SketchLine_28)(Plug/Modified_Face&Sketch_1/SketchLine_3)(Plug/Modified_Face&Sketch_1/SketchLine_29)(Plug/Modified_Face&Sketch_1/SketchLine_30)(Plug/Modified_Face&Sketch_1/SketchLine_31)(Plug/Modified_Face&Sketch_1/SketchLine_33)(Plug/Modified_Face&Sketch_1/SketchLine_34)(Plug/Modified_Face&Sketch_1/SketchLine_1)(Plug/Modified_Face&Sketch_1/SketchLine_2)(Plug/Modified_Face&Sketch_1/SketchLine_32)"), model.selection("FACE", "(Plug/Modified_Face&Sketch_1/SketchLine_10)(Plug/Modified_Face&Sketch_1/SketchLine_9)(Plug/Modified_Face&Sketch_1/SketchArc_1_2)(Plug/Modified_Face&Sketch_1/SketchLine_7)(Plug/Modified_Face&Sketch_5/SketchLine_64)(Plug/Modified_Face&Sketch_1/SketchLine_8)(Plug/Modified_Face&Sketch_1/SketchLine_11)(Plug/Modified_Face&Sketch_1/SketchLine_12)(Plug/Modified_Face&Sketch_1/SketchLine_13)(Plug/Modified_Face&Sketch_1/SketchLine_14)(Plug/Modified_Face&Sketch_1/SketchLine_15)(Plug/Modified_Face&Sketch_1/SketchLine_16)(Plug/Modified_Face&Sketch_1/SketchLine_17)(Plug/Modified_Face&Sketch_1/SketchLine_18)(Plug/Modified_Face&Sketch_1/SketchLine_19)(Plug/Modified_Face&Sketch_1/SketchLine_20)(Plug/Modified_Face&Sketch_1/SketchLine_6)(Plug/Modified_Face&Sketch_1/SketchLine_5)(Plug/Modified_Face&Sketch_1/SketchLine_4)(Plug/Modified_Face&Sketch_2/SketchCircle_1_2)(Plug/Modified_Face&Sketch_1/SketchLine_28)(Plug/Modified_Face&Sketch_1/SketchLine_27)(Plug/Modified_Face&Sketch_1/SketchLine_26)(Plug/Modified_Face&Sketch_1/SketchLine_25)(Plug/Modified_Face&Sketch_1/SketchLine_24)(Plug/Modified_Face&Sketch_1/SketchLine_23)(Plug/Modified_Face&Sketch_1/SketchLine_22)(Plug/Modified_Face&Sketch_1/SketchLine_21)"), model.selection("FACE", "(Plug/Modified_Face&Sketch_1/SketchArc_1_2)(Plug/Modified_Face&Sketch_4/SketchLine_57)(Plug/Modified_Face&Sketch_4/SketchLine_58)(Plug/Modified_Face&Sketch_4/SketchArc_2_2)(Plug/Modified_Face&Sketch_4/SketchLine_55)(Plug/Modified_Face&Sketch_1/SketchLine_6)(Plug/Modified_Face&Sketch_1/SketchLine_5)(Plug/Modified_Face&Sketch_1/SketchLine_4)(Plug/Modified_Face&Sketch_1/SketchLine_28)(Plug/Modified_Face&Sketch_1/SketchLine_27)(Plug/Modified_Face&Sketch_1/SketchLine_26)(Plug/Modified_Face&Sketch_1/SketchLine_25)(Plug/Modified_Face&Sketch_1/SketchLine_24)(Plug/Modified_Face&Sketch_1/SketchLine_23)(Plug/Modified_Face&Sketch_1/SketchLine_22)(Plug/Modified_Face&Sketch_1/SketchLine_21)(Plug/Modified_Face&Sketch_1/SketchLine_3)(Plug/Modified_Face&Sketch_1/SketchLine_29)(Plug/Modified_Face&Sketch_1/SketchLine_30)(Plug/Modified_Face&Sketch_1/SketchLine_31)(Plug/Modified_Face&Sketch_3/SketchLine_42)(Plug/Modified_Face&Sketch_3/SketchLine_41)(Plug/Modified_Face&Sketch_3/SketchLine_40)(Plug/Modified_Face&Sketch_1/SketchLine_33)(Plug/Modified_Face&Sketch_1/SketchLine_34)(Plug/Modified_Face&Sketch_1/SketchLine_1)(Plug/Modified_Face&Sketch_1/SketchLine_2)"), model.selection("FACE", "(Plug/Modified_Face&Sketch_1/SketchLine_10)(Plug/Modified_Face&Sketch_1/SketchLine_9)(Plug/Modified_Face&Sketch_1/SketchArc_1_2)(Plug/Modified_Face&Sketch_1/SketchLine_7)(Plug/Modified_Face&Sketch_5/SketchLine_64)(Plug/Modified_Face&Sketch_1/SketchLine_8)(Plug/Modified_Face&Sketch_1/SketchLine_11)(Plug/Modified_Face&Sketch_1/SketchLine_12)(Plug/Modified_Face&Sketch_1/SketchLine_13)(Plug/Modified_Face&Sketch_1/SketchLine_14)(Plug/Modified_Face&Sketch_1/SketchLine_15)(Plug/Modified_Face&Sketch_1/SketchLine_16)(Plug/Modified_Face&Sketch_1/SketchLine_17)(Plug/Modified_Face&Sketch_1/SketchLine_18)(Plug/Modified_Face&Sketch_1/SketchLine_19)(Plug/Modified_Face&Sketch_1/SketchLine_20)(Plug/Modified_Face&Sketch_4/SketchLine_57)(Plug/Modified_Face&Sketch_4/SketchLine_58)(Plug/Modified_Face&Sketch_4/SketchArc_2_2)(Plug/Modified_Face&Sketch_4/SketchLine_55)")]) -Group_1.result().setColor(68, 68, 68) -# check Group_1 -model.checkGroup(Group_1, GeomAPI_Shape.FACE) - model.do() # change parameters of the model @@ -519,8 +514,6 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [364]) model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [728]) model.testResultsVolumes(Result, [23373.503259112552768783643841743]) -model.checkGroup(Group_1, GeomAPI_Shape.FACE) - model.end() assert(model.checkPythonDump()) -- 2.39.2