]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve unit-tests and coverage.
authormpv <mpv@opencascade.com>
Wed, 29 May 2019 08:02:20 +0000 (11:02 +0300)
committermpv <mpv@opencascade.com>
Wed, 29 May 2019 08:02:20 +0000 (11:02 +0300)
src/ConnectorAPI/Test/tests.set
src/FeaturesPlugin/Test/TestRemoveResultsBody.py
src/ModelHighAPI/ModelHighAPI_Interface.cpp

index e88e02de4f1aada9a54e22c8cf544c6ee2af10ce..48dac192830861e2cf9d8ba9ec07b9681b69cae3 100644 (file)
@@ -20,5 +20,6 @@
 SET(TEST_NAMES
   TestExportToGEOM
   TestExportToGEOMAllGroupsAndFields
+  TestExportToGEOMPartSet.py
   Test2882
 )
index 5ede10d2bace526c14177603de3e468d2bb4cf66..9fdd04118ddb870649ebb48ef81465c5d5ade6ec 100644 (file)
@@ -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)
 
index ad53e125b0c8581ce5663969c92844bee96a670b..cb0373bfa4c2ef4582f6851a6d308bb151dcc143 100644 (file)
@@ -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_Selection> ModelHighAPI_Interface::results() const
 
   std::list<ModelHighAPI_Selection> aSelectionList;
 
-  std::list<std::shared_ptr<ModelAPI_Result> > 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<std::shared_ptr<ModelAPI_Result> > 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;