From: mpv Date: Wed, 29 May 2019 08:02:20 +0000 (+0300) Subject: Improve unit-tests and coverage. X-Git-Tag: VEDF2019Lot4~123 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=afb58628d7f9d325b408e249f7dbf7c5b1628948;p=modules%2Fshaper.git Improve unit-tests and coverage. --- diff --git a/src/ConnectorAPI/Test/tests.set b/src/ConnectorAPI/Test/tests.set index e88e02de4..48dac1928 100644 --- a/src/ConnectorAPI/Test/tests.set +++ b/src/ConnectorAPI/Test/tests.set @@ -20,5 +20,6 @@ SET(TEST_NAMES TestExportToGEOM TestExportToGEOMAllGroupsAndFields + TestExportToGEOMPartSet.py Test2882 ) diff --git a/src/FeaturesPlugin/Test/TestRemoveResultsBody.py b/src/FeaturesPlugin/Test/TestRemoveResultsBody.py index 5ede10d2b..9fdd04118 100644 --- a/src/FeaturesPlugin/Test/TestRemoveResultsBody.py +++ b/src/FeaturesPlugin/Test/TestRemoveResultsBody.py @@ -18,6 +18,7 @@ # from salome.shaper import model +from ModelAPI import * model.begin() partSet = model.moduleDocument() @@ -27,11 +28,10 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 2) model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) +removeResults(Extrusion_1.feature().results()) model.end() # check the number of bodies = 0, number of construction = 1 -from ModelAPI import * assert(Part_1.document().size(ModelAPI_ResultConstruction.group()) == 1) assert(Part_1.document().size(ModelAPI_ResultBody.group()) == 0) diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index ad53e125b..cb0373bfa 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -88,7 +88,8 @@ void ModelHighAPI_Interface::execute(bool isForce) void ModelHighAPI_Interface::setName(const std::string& theName) { - feature()->data()->setName(theName); + if (feature().get()) + feature()->data()->setName(theName); } std::string ModelHighAPI_Interface::name() const @@ -110,10 +111,12 @@ std::list ModelHighAPI_Interface::results() const std::list aSelectionList; - std::list > aResults = feature()->results(); - for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) { - if (!(*it)->isDisabled()) - aSelectionList.push_back(ModelHighAPI_Selection(*it)); + if (feature().get()) { + std::list > aResults = feature()->results(); + for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) { + if (!(*it)->isDisabled()) + aSelectionList.push_back(ModelHighAPI_Selection(*it)); + } } return aSelectionList;