]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[Code coverage GeomValidators]: Exclude validations related to GUI. Remove unused...
authorazv <azv@opencascade.com>
Tue, 18 Dec 2018 06:18:21 +0000 (09:18 +0300)
committerazv <azv@opencascade.com>
Tue, 18 Dec 2018 06:18:21 +0000 (09:18 +0300)
src/GeomValidators/GeomValidators_Different.cpp
src/GeomValidators/GeomValidators_Face.cpp
src/GeomValidators/GeomValidators_FeatureKind.cpp
src/GeomValidators/GeomValidators_NotSelfIntersected.cpp
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ValueOrder.cpp
src/GeomValidators/GeomValidators_ZeroOffset.cpp

index 012727330302dd2b15c738064a3611e8369c6835..71c12e4f4e780c821d4c74f7f09ae0627ab4b983 100644 (file)
@@ -109,7 +109,9 @@ bool GeomValidators_Different::isValid(const std::shared_ptr<ModelAPI_Feature>&
   return true;
 }
 
+// LCOV_EXCL_START
 bool GeomValidators_Different::isNotObligatory(std::string theFeature, std::string theAttribute)
 {
   return true;
 }
+// LCOV_EXCL_STOP
index 69170232dd7c8cb7f489a09a92dbc04c57e62e36..45dd27d50de0ff68983f8a734a68745779829494 100644 (file)
@@ -43,8 +43,10 @@ GeomAbs_SurfaceType faceType(const std::string& theType)
   if (MyFaceTypes.find(aType) != MyFaceTypes.end())
     return MyFaceTypes[aType];
 
+// LCOV_EXCL_START
   Events_InfoMessage("GeomValidators_Face", "Face type defined in XML is not implemented!").send();
   return GeomAbs_Plane;
+// LCOV_EXCL_STOP
 }
 
 bool isValidFace(const GeomShapePtr theShape,
index e25ef26811b930c2c6813f46625b6674689a3a80..72845eb11328f882a58b560d58e290779315ed58 100755 (executable)
@@ -49,30 +49,6 @@ bool GeomValidators_FeatureKind::isValid(const AttributePtr& theAttribute,
   }
 
   std::string anAttributeType = theAttribute->attributeType();
-  if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
-    AttributeSelectionListPtr aSelectionListAttr =
-                      std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
-    // all context objects should be sketch entities
-    for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize && isSketchEntities; i++) {
-      AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
-      ObjectPtr anObject = aSelectAttr->context();
-      // a context of the selection attribute is a feature result. It can be a case when the result
-      // of the feature is null, e.g. the feature is modified and has not been executed yet.
-      // The validator returns an invalid result here. The case is an extrusion built on a sketch
-      // feature. A new sketch element creation leads to an empty result.
-      if (!anObject.get())
-        isSketchEntities = false;
-      else {
-        FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
-        isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
-#ifdef DEBUG_EXTRUSION_INVALID_SKETCH
-        CompositeFeaturePtr aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
-        if (aComp.get() && aComp->numberOfSubs() == 1)
-          return false;
-#endif
-      }
-    }
-  }
   if (anAttributeType == ModelAPI_AttributeSelection::typeId()) {
     AttributeSelectionPtr aSelectAttr =
                       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
@@ -88,52 +64,6 @@ bool GeomValidators_FeatureKind::isValid(const AttributePtr& theAttribute,
       isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
     }
   }
-  if (anAttributeType == ModelAPI_AttributeRefList::typeId()) {
-    AttributeRefListPtr aRefListAttr =
-      std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
-    // all context objects should be sketch entities
-    for (int i = 0, aSize = aRefListAttr->size(); i < aSize && isSketchEntities; i++) {
-      ObjectPtr anObject = aRefListAttr->object(i);
-      // a context of the selection attribute is a feature result. It can be a case when the result
-      // of the feature is null, e.g. the feature is modified and has not been executed yet.
-      // The validator returns an invalid result here. The case is an extrusion built on a sketch
-      // feature. A new sketch element creation leads to an empty result.
-      if (!anObject.get())
-        isSketchEntities = false;
-      else {
-        FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
-        isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
-      }
-    }
-  }
-  if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
-    std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-                     std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
-    isSketchEntities = false;
-    if (aRef->isObject()) {
-      ObjectPtr anObject = aRef->object();
-      if (anObject.get() != NULL) {
-        FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
-        if (aFeature.get() != NULL)
-          isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
-      }
-    }
-  }
-  if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
-    AttributeReferencePtr aRefAttr =
-                      std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
-    ObjectPtr anObject = aRefAttr->value();
-    // a context of the selection attribute is a feature result. It can be a case when the result
-    // of the feature is null, e.g. the feature is modified and has not been executed yet.
-    // The validator returns an invalid result here. The case is an extrusion built on a sketch
-    // feature. A new sketch element creation leads to an empty result.
-    if (!anObject.get())
-      isSketchEntities = false;
-    else {
-      FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
-      isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
-    }
-  }
   if (!isSketchEntities) {
     theError = "It refers to feature, which kind is not in the list: " + anEntityKindsStr;
   }
index c4d491515f04469021f1b9bf8fb8374d4ad2d8d1..98963a128bcab534c7549fcf73a861af46ad5b33 100644 (file)
@@ -97,8 +97,10 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptr<ModelAPI_F
   return true;
 }
 
+// LCOV_EXCL_START
 bool GeomValidators_NotSelfIntersected::isNotObligatory(std::string /*theFeature*/,
                                                         std::string /*theAttribute*/)
 {
   return false;
 }
+// LCOV_EXCL_STOP
index 18620d14ad4c6da44e58919b7287117bad77eea5..c166b9cf0c73744032e125de3819d3ae52a8e68f 100755 (executable)
@@ -62,10 +62,13 @@ GeomValidators_ShapeType::TypeOfShape
   if (MyShapeTypes.find(aType) != MyShapeTypes.end())
     return MyShapeTypes[aType];
 
+// LCOV_EXCL_START
   Events_InfoMessage("Shape type defined in XML is not implemented!").send();
   return AnyShape;
+// LCOV_EXCL_STOP
 }
 
+// LCOV_EXCL_START
 std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape& theType)
 {
   std::string aValue = "";
@@ -81,6 +84,7 @@ std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape&
   }
   return aValue;
 }
+// LCOV_EXCL_STOP
 
 bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute,
                                        const std::list<std::string>& theArguments,
index 03654381f7494b4d026a12fa181d141ae6cdbdab..334600888dfeb7be6db2c6df9c11ae977f50676b 100644 (file)
@@ -28,6 +28,7 @@
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 
+// LCOV_EXCL_START
 static double attributeValue(AttributePtr theAttr)
 {
   AttributeIntegerPtr anIntAttr = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(theAttr);
@@ -92,7 +93,7 @@ static bool isValidOrder(const AttributePtr& theAttribute,
 
   return true;
 }
-
+// LCOV_EXCL_STOP
 
 
 /// Global instance for validators factory
@@ -107,13 +108,14 @@ GeomValidators_GreaterOrEqual::GeomValidators_GreaterOrEqual()
   aFactory->registerValidator("GeomValidators_GreaterOrEqual", this);
 }
 
+// LCOV_EXCL_START
 bool GeomValidators_GreaterOrEqual::isValid(const AttributePtr& theAttribute,
                                             const std::list<std::string>& theArguments,
                                             Events_InfoMessage& theError) const
 {
   return isValidOrder(theAttribute, theArguments, theError, &isGreaterOrEqual);
 }
-
+// LCOV_EXCL_STOP
 
 
 GeomValidators_LessOrEqual::GeomValidators_LessOrEqual()
@@ -124,9 +126,11 @@ GeomValidators_LessOrEqual::GeomValidators_LessOrEqual()
   aFactory->registerValidator("GeomValidators_LessOrEqual", this);
 }
 
+// LCOV_EXCL_START
 bool GeomValidators_LessOrEqual::isValid(const AttributePtr& theAttribute,
                                          const std::list<std::string>& theArguments,
                                          Events_InfoMessage& theError) const
 {
   return isValidOrder(theAttribute, theArguments, theError, &isLessOrEqual);
 }
+// LCOV_EXCL_STOP
index c5a1d8243eb0958799c42d9e4b51898eced72252..325bb2718b91384a35ac4663473103511704b1f1 100644 (file)
@@ -59,6 +59,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
 
   ListOfShape aFacesList;
   if(theFeature->selection(*anIt)) {
+// LCOV_EXCL_START
     AttributeSelectionPtr aFaceSelection = theFeature->selection(*anIt);
     ResultConstructionPtr aConstruction =
       std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFaceSelection->context());
@@ -72,6 +73,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
         }
       }
     }
+// LCOV_EXCL_STOP
   } else if(theFeature->selectionList(*anIt)) {
     AttributeSelectionListPtr aFacesSelectionList = theFeature->selectionList(*anIt);
     for(int anIndex = 0; anIndex < aFacesSelectionList->size(); anIndex++) {
@@ -225,6 +227,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
 }
 
 //=================================================================================================
+// LCOV_EXCL_START
 bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, std::string theAttribute)
 {
   if(theAttribute == "from_object" || theAttribute == "to_object") {
@@ -233,3 +236,4 @@ bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, std::str
 
   return false;
 }
+// LCOV_EXCL_STOP