From 0c9b5c21593b0a8a1319502a56e505ffe24a4a4d Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Mon, 21 Nov 2016 15:45:43 +0100 Subject: [PATCH] Correction following Mikhail's mail (21/11/2016). --- .../Test => FeaturesAPI}/APIParam_Translation.py | 0 src/FeaturesAPI/CMakeLists.txt | 5 ++++- src/FeaturesAPI/FeaturesAPI_Translation.h | 12 ++++++------ src/FeaturesPlugin/CMakeLists.txt | 3 +-- src/FeaturesPlugin/Test/TestTranslation.py | 4 ++-- src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp | 7 ------- 6 files changed, 13 insertions(+), 18 deletions(-) rename src/{FeaturesPlugin/Test => FeaturesAPI}/APIParam_Translation.py (100%) diff --git a/src/FeaturesPlugin/Test/APIParam_Translation.py b/src/FeaturesAPI/APIParam_Translation.py similarity index 100% rename from src/FeaturesPlugin/Test/APIParam_Translation.py rename to src/FeaturesAPI/APIParam_Translation.py diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index 3f4e5fe9a..155141244 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -1,6 +1,7 @@ -## Copyright (C) 2014-20xx CEA/DEN, EDF R&D +## Copyright (C) 2014-2016 CEA/DEN, EDF R&D INCLUDE(Common) +INCLUDE(UnitTest) SET(PROJECT_HEADERS FeaturesAPI.h @@ -90,3 +91,5 @@ ENDIF(WIN32) INSTALL(TARGETS _FeaturesAPI DESTINATION ${SHAPER_INSTALL_SWIG}) INSTALL(TARGETS FeaturesAPI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/FeaturesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG}) + +ADD_UNIT_TESTS(APIParam_Translation.py) \ No newline at end of file diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.h b/src/FeaturesAPI/FeaturesAPI_Translation.h index 7a14f8a88..91f3e7e14 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.h +++ b/src/FeaturesAPI/FeaturesAPI_Translation.h @@ -30,15 +30,15 @@ public: /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature, + const std::list& theMainObjects, + const ModelHighAPI_Selection& theAxisObject, + const ModelHighAPI_Double& theDistance); /// Constructor with values. FEATURESAPI_EXPORT - FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, + explicit FeaturesAPI_Translation(const std::shared_ptr& theFeature, + const std::list& theMainObjects, const ModelHighAPI_Double& theDx, const ModelHighAPI_Double& theDy, const ModelHighAPI_Double& theDz); diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 53c6e292e..8afae28a6 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -131,5 +131,4 @@ ADD_UNIT_TESTS(TestExtrusion.py TestUnion.py TestRemoveSubShapes.py TestPipe.py - TestRecover.py - APIParam_Translation.py) + TestRecover.py) diff --git a/src/FeaturesPlugin/Test/TestTranslation.py b/src/FeaturesPlugin/Test/TestTranslation.py index 8991ebad4..59208b43c 100644 --- a/src/FeaturesPlugin/Test/TestTranslation.py +++ b/src/FeaturesPlugin/Test/TestTranslation.py @@ -133,5 +133,5 @@ assert (len(aMoveFt.results()) > 0) aMoveResult = modelAPI_ResultBody(aMoveFt.firstResult()) assert (aMoveResult is not None) -#import model -#assert(model.checkPythonDump()) +import model +assert(model.checkPythonDump()) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp index 148bfacf8..9fee16ebf 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp @@ -45,7 +45,6 @@ bool GeomAlgoAPI_Translation::check() myError = "Translation builder :: axis is invalid."; return false; } - // TODO : verification de la distance if (!mySourceShape) { myError = "Translation builder :: source shape is invalid."; return false; @@ -53,12 +52,6 @@ bool GeomAlgoAPI_Translation::check() return true; } case BY_DIM: { - if ((fabs(myDx) < Precision::Confusion()) && - (fabs(myDy) < Precision::Confusion()) && - (fabs(myDz) < Precision::Confusion())) { - myError = "Translation builder :: Dx, Dy and Dz are null."; - return false; - } if (!mySourceShape) { myError = "Translation builder :: source shape is invalid."; return false; -- 2.39.2