From: azv Date: Tue, 18 Dec 2018 06:18:21 +0000 (+0300) Subject: [Code coverage GeomValidators]: Exclude validations related to GUI. Remove unused... X-Git-Tag: End2018~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4c164d4f7510e7fca3fd2bfd88b396bdeb499a08;p=modules%2Fshaper.git [Code coverage GeomValidators]: Exclude validations related to GUI. Remove unused code. --- diff --git a/src/GeomValidators/GeomValidators_Different.cpp b/src/GeomValidators/GeomValidators_Different.cpp index 012727330..71c12e4f4 100644 --- a/src/GeomValidators/GeomValidators_Different.cpp +++ b/src/GeomValidators/GeomValidators_Different.cpp @@ -109,7 +109,9 @@ bool GeomValidators_Different::isValid(const std::shared_ptr& return true; } +// LCOV_EXCL_START bool GeomValidators_Different::isNotObligatory(std::string theFeature, std::string theAttribute) { return true; } +// LCOV_EXCL_STOP diff --git a/src/GeomValidators/GeomValidators_Face.cpp b/src/GeomValidators/GeomValidators_Face.cpp index 69170232d..45dd27d50 100644 --- a/src/GeomValidators/GeomValidators_Face.cpp +++ b/src/GeomValidators/GeomValidators_Face.cpp @@ -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, diff --git a/src/GeomValidators/GeomValidators_FeatureKind.cpp b/src/GeomValidators/GeomValidators_FeatureKind.cpp index e25ef2681..72845eb11 100755 --- a/src/GeomValidators/GeomValidators_FeatureKind.cpp +++ b/src/GeomValidators/GeomValidators_FeatureKind.cpp @@ -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(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(aFeature); - if (aComp.get() && aComp->numberOfSubs() == 1) - return false; -#endif - } - } - } if (anAttributeType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = std::dynamic_pointer_cast(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(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 aRef = - std::dynamic_pointer_cast(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(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; } diff --git a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp index c4d491515..98963a128 100644 --- a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp +++ b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp @@ -97,8 +97,10 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptr& theArguments, diff --git a/src/GeomValidators/GeomValidators_ValueOrder.cpp b/src/GeomValidators/GeomValidators_ValueOrder.cpp index 03654381f..334600888 100644 --- a/src/GeomValidators/GeomValidators_ValueOrder.cpp +++ b/src/GeomValidators/GeomValidators_ValueOrder.cpp @@ -28,6 +28,7 @@ #include #include +// LCOV_EXCL_START static double attributeValue(AttributePtr theAttr) { AttributeIntegerPtr anIntAttr = std::dynamic_pointer_cast(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& 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& theArguments, Events_InfoMessage& theError) const { return isValidOrder(theAttribute, theArguments, theError, &isLessOrEqual); } +// LCOV_EXCL_STOP diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index c5a1d8243..325bb2718 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -59,6 +59,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& ListOfShape aFacesList; if(theFeature->selection(*anIt)) { +// LCOV_EXCL_START AttributeSelectionPtr aFaceSelection = theFeature->selection(*anIt); ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aFaceSelection->context()); @@ -72,6 +73,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& } } } +// 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& } //================================================================================================= +// 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