]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve code coverage metrics.
authorazv <azv@opencascade.com>
Tue, 20 Aug 2019 07:57:03 +0000 (10:57 +0300)
committerazv <azv@opencascade.com>
Tue, 20 Aug 2019 07:57:03 +0000 (10:57 +0300)
src/Config/Config_FeatureMessage.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp
src/FiltersPlugin/Test/TestFilters.py
src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp
src/GeomValidators/GeomValidators_MinObjectsSelected.cpp
src/ModelAPI/Test/TestFolder_Sketch.py

index fdc684cc3b849dda2f57b1585bb35cd664e98e70..47baeae2ee4da30faf6e77d3bb567fcf84bdd26e 100644 (file)
@@ -147,6 +147,7 @@ void Config_FeatureMessage::setPluginLibrary(const std::string& myPluginLibrary)
   this->myPluginLibrary = myPluginLibrary;
 }
 
+// LCOV_EXCL_START
 bool Config_FeatureMessage::isUseInput() const
 {
   return myUseInput;
@@ -176,7 +177,7 @@ bool Config_FeatureMessage::isApplyContinue() const
 {
   return myIsApplyContinue;
 }
-
+// LCOV_EXCL_STOP
 
 void Config_FeatureMessage::setUseInput(bool isUseInput)
 {
index b9af9671352fd044aa1e628b1af8dad648aa5916..10368e91e643f8d0cac8bb6486611ee036cc5994 100644 (file)
@@ -173,8 +173,7 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
     } else {
       std::string anError;
       ListOfShape aListOfShape;
-      std::shared_ptr<GeomAlgoAPI_MakeShapeList>
-          aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList);
+      ListOfMakeShape aMakeShapeList;
 
       for (int i=0; i<nbCopies; i++) {
         std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
@@ -194,8 +193,12 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
           break;
         }
         aListOfShape.push_back(aTranslationAlgo->shape());
-        aListOfTranslationAlgo->appendAlgo(aTranslationAlgo);
+        aMakeShapeList.push_back(aTranslationAlgo);
       }
+
+      std::shared_ptr<GeomAlgoAPI_MakeShapeList>
+          aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList(aMakeShapeList));
+
       std::shared_ptr<GeomAPI_Shape> aCompound =
         GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
@@ -366,8 +369,7 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
     } else {
       std::string anError;
       ListOfShape aListOfShape;
-      std::shared_ptr<GeomAlgoAPI_MakeShapeList>
-          aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList);
+      ListOfMakeShape aMakeShapeList;
 
       for (int j=0; j<aSecondNbCopies; j++) {
         for (int i=0; i<aFirstNbCopies; i++) {
@@ -391,9 +393,13 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
             break;
           }
           aListOfShape.push_back(aTranslationAlgo->shape());
-          aListOfTranslationAlgo->appendAlgo(aTranslationAlgo);
+          aMakeShapeList.push_back(aTranslationAlgo);
         }
       }
+
+      std::shared_ptr<GeomAlgoAPI_MakeShapeList>
+          aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList(aMakeShapeList));
+
       std::shared_ptr<GeomAPI_Shape> aCompound =
         GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
index c08497fe88281dba8369c6c6084064c836c1ac0c..75b480faf75736cc2679cf9881095411c6888d06 100644 (file)
@@ -25,13 +25,13 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Top"), model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = []), model.addFilter(name = "HorizontalFaces")])])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Bottom"), model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "Box_1_1")]), model.addFilter(name = "HorizontalFaces"), model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "PartSet/XOY")])])])
 model.end()
 
 aFactory = ModelAPI_Session.get().validators()
 
 GroupFeature = Group_1.feature()
 assert(aFactory.validate(GroupFeature))
-assert(GroupFeature.selectionList("group_list").size() == 2)
+assert(GroupFeature.selectionList("group_list").size() == 1)
 
 assert(model.checkPythonDump())
index 264c6bd30367566b8e8d401cf51d0cbaef9c7f38..24fc81624b9355d7731cbc1a18da1af01c54a269 100644 (file)
@@ -79,30 +79,8 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes)
 }
 
 //==================================================================================================
-#include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
 
-typedef std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator> MapFaceSolid;
-static void facesBelongingToSolids(const GeomShapePtr& theShape,
-                                   MapFaceSolid& theShapeRelations)
-{
-  for (GeomAPI_ShapeExplorer aSolidExp(theShape, GeomAPI_Shape::SHELL);
-       aSolidExp.more(); aSolidExp.next()) {
-    GeomShapePtr aSolid = aSolidExp.current();
-    for (GeomAPI_ShapeExplorer aFaceExp(aSolid, GeomAPI_Shape::FACE);
-         aFaceExp.more(); aFaceExp.next())
-      theShapeRelations[aFaceExp.current()].push_back(aSolid);
-  }
-}
-
-static bool isShapeInList(const GeomShapePtr& theShape, const ListOfShape& theList)
-{
-  for (ListOfShape::const_iterator anIt = theList.begin(); anIt != theList.end(); ++anIt)
-    if (theShape->isEqual(*anIt))
-      return true;
-  return false;
-}
-
 void GeomAlgoAPI_Sewing::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
                                   ListOfShape& theHistory)
 {
index 56f93b2bfaf7763eb1223a4dd1b42f320807f10d..ca3ebc7a2aef4c871355f0c678c700ca4844d958 100644 (file)
@@ -52,7 +52,7 @@ bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptr<ModelAPI_F
 
   if(anObjectsNb < aMinObjectsNb) {
     theError = "Error: Attribute \"%1\" should contain at least %2 items.";
-    theError.arg(aSelectionListId).arg(theArguments.back());
+    theError.arg(aSelectionListId).arg(aMinObjectsNb);
     return false;
   }
 
index ecaef91c0f50a562f190d668e4b465df03c117b0..0918ddaec0175632007a8a4484c58a3778d51d4e 100644 (file)
@@ -132,6 +132,10 @@ aFound = aPartDoc.findContainingFolder(Sketch_2.feature())
 assert(aFound[0].data().isEqual(aFolder.data()))
 assert(aFound[1] == 0)
 
+# check sketch is the last feature in the folder
+aLastFeature = Folder_2.lastVisibleFeature()
+assert(aLastFeature.getKind() == "Sketch")
+
 
 #=========================================================================
 # Test 3. Sketch could be removed from the folder