From: azv Date: Mon, 22 Aug 2016 13:00:32 +0000 (+0300) Subject: Fix problems in sketch unit tests X-Git-Tag: V_2.5.0~137^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3bae3a116dfb567e8c89830bda607e6b2b6c0174;p=modules%2Fshaper.git Fix problems in sketch unit tests --- diff --git a/src/GeomAPI/GeomAPI_Circ2d.cpp b/src/GeomAPI/GeomAPI_Circ2d.cpp index 4ac745864..cbb16dd4b 100644 --- a/src/GeomAPI/GeomAPI_Circ2d.cpp +++ b/src/GeomAPI/GeomAPI_Circ2d.cpp @@ -39,7 +39,7 @@ static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY, if (aCenter.IsEqual(aPoint, Precision::Confusion())) return NULL; - gp_Dir2d aDir(theCenterX - thePointX, theCenterY - thePointY); + gp_Dir2d aDir(thePointX - theCenterX, thePointY - theCenterY); return newCirc2d(theCenterX, theCenterY, aDir, aRadius); } diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 7f4e3e58a..ce17351bc 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -36,7 +36,7 @@ #include #include -#define PRECISION 7 +#define PRECISION 6 #define TOLERANCE (1.e-7) ModelHighAPI_FeatureStore::ModelHighAPI_FeatureStore(FeaturePtr theFeature) { @@ -117,12 +117,12 @@ std::string ModelHighAPI_FeatureStore::compareData(std::shared_ptr 0) theOutput << " "; - theOutput << std::fixed << setprecision(PRECISION) + theOutput << std::fixed << setprecision(thePrecision) << (fabs(theArray[i]) < TOLERANCE ? 0.0 : theArray[i]); } } @@ -168,9 +168,14 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { aResult<text(); } else if (aType == ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttr = std::dynamic_pointer_cast(theAttr); + int aPrecision = PRECISION; + // Special case - precision for the arc angle. It is calculated with tolerance 1e-4, + // so the value has only 4 correct digits + if (anAttr->id() == "ArcAngle") + aPrecision = 1; if (anAttr->text().empty()) { double aVal = anAttr->value(); - dumpArray(aResult, &aVal, 1); + dumpArray(aResult, &aVal, 1, aPrecision); } else aResult<text(); } else if (aType == ModelAPI_AttributeBoolean::typeId()) { @@ -298,7 +303,9 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr& // output the main characteristics aResult<<"Volume: "< aCenter = GeomAlgoAPI_ShapeTools::centreOfMass(theShape); - aResult<<"Center of mass: "<x()<<" "<y()<<" "<z()<x(), aCenter->y(), aCenter->z()}; + dumpArray(aResult, aCenterVals, 3); + aResult< aDistance = - std::dynamic_pointer_cast(createParameter(theGroupID, aDist)); + std::dynamic_pointer_cast(createParameter(theGroupID, aDist * 0.5)); aConstrList.push_back(GCSConstraintPtr( new GCS::ConstraintP2PDistance(*aPoint, aLine->p1, aDistance->parameter()))); aConstrList.push_back(GCSConstraintPtr(