From f8ed001c4a939d63bf85445c479df63274838a3b Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 22 Jan 2025 14:24:35 +0100 Subject: [PATCH] [tests] Template method design pattern from BaseTest in derived classes (#5162) * [tests] Template method design pattern from BaseTest in derived classes * rename * use the deprecated function * Make SetUp and TearDown final * fix SofaCarving test * missing override --- .../tests/CollisionPipeline_test.cpp | 4 +- .../tests/LocalMinDistance_test.cpp | 4 +- .../Collision/Geometry/tests/Sphere_test.cpp | 4 +- .../Geometry/tests/Triangle_test.cpp | 4 +- ...ffineMovementProjectiveConstraint_test.cpp | 2 +- .../DirectionProjectiveConstraint_test.cpp | 4 +- .../tests/LineProjectiveConstraint_test.cpp | 4 +- .../tests/PlaneProjectiveConstraint_test.cpp | 4 +- .../tests/PointProjectiveConstraint_test.cpp | 4 +- .../Analyze/tests/AverageCoord_test.cpp | 2 +- .../Analyze/tests/ClusteringEngine_test.cpp | 2 +- .../ExtrudeEdgesAndGenerateQuads_test.cpp | 2 +- .../Generate/tests/MergePoints_test.cpp | 2 +- .../Engine/Select/tests/BoxROI_test.cpp | 4 +- .../Select/tests/ComplementaryROI_test.cpp | 2 +- .../Engine/Select/tests/MeshROI_test.cpp | 4 +- .../Select/tests/MeshSubsetEngine_test.cpp | 4 +- .../Engine/Select/tests/PlaneROI_test.cpp | 2 +- .../Engine/Select/tests/SphereROI_test.cpp | 2 +- .../Transform/tests/DifferenceEngine_test.cpp | 2 +- .../Transform/tests/DilateEngine_test.cpp | 2 +- .../Transform/tests/SmoothMeshEngine_test.cpp | 2 +- .../IO/Mesh/tests/MeshExporter_test.cpp | 4 +- .../IO/Mesh/tests/MeshGmshLoader_test.cpp | 2 +- .../IO/Mesh/tests/STLExporter_test.cpp | 4 +- .../tests/VisualModelOBJExporter_test.cpp | 4 +- .../Linear/tests/BarycentricMapping_test.cpp | 2 +- .../NonLinear/tests/RigidMapping_test.cpp | 2 +- .../tests/SquareDistanceMapping_test.cpp | 2 +- .../Mass/tests/DiagonalMass_test.cpp | 4 +- .../Mass/tests/MeshMatrixMass_test.cpp | 4 +- .../Component/Mass/tests/UniformMass_test.cpp | 4 +- .../tests/ConstantForceField_test.cpp | 4 +- .../tests/PlaneForceField_test.cpp | 4 +- .../tests/SkeletalMotionConstraint_test.cpp | 4 +- .../tests/SpringSolverDynamic_test.cpp | 2 +- .../Backward/tests/StaticSolver_test.cpp | 4 +- .../Playback/tests/WriteState_test.cpp | 8 +--- .../tests/AddResourceRepository_test.cpp | 2 +- .../tests/BaseTetrahedronFEMForceField_test.h | 4 +- .../Elastic/tests/BeamFEMForceField_test.cpp | 4 +- .../tests/TriangleFEMForceField_test.cpp | 4 +- ...perelasticityFEMForceField_params_test.cpp | 2 +- ...yperelasticityFEMForceField_scene_test.cpp | 2 +- .../tests/TriangularBendingSprings_test.cpp | 4 +- .../simutests/AffinePatch_test.cpp | 2 +- .../simutests/LinearElasticity_test.cpp | 4 +- .../TetrahedronNumericalIntegration_test.cpp | 4 +- .../TriangleNumericalIntegration_test.cpp | 4 +- .../Grid/tests/SparseGridTopology_test.cpp | 2 +- .../tests/TopologicalChangeProcessor_test.cpp | 4 +- .../Utility/tests/TopologyChecker_test.cpp | 4 +- .../src/sofa/component/visual/VisualStyle.h | 4 +- .../Rendering2D/tests/OglLabel_test.cpp | 2 +- .../Rendering3D/tests/ClipPlane_test.cpp | 2 +- .../Shader/tests/LightManager_test.cpp | 2 +- Sofa/GL/Component/Shader/tests/Light_test.cpp | 2 +- Sofa/framework/Core/test/DataEngine_test.cpp | 2 +- Sofa/framework/Core/test/Engine_test.cpp | 2 +- Sofa/framework/Core/test/TrackedData_test.cpp | 2 +- .../BaseObjectDescription_test.cpp | 4 +- .../test/objectmodel/DataFileName_test.cpp | 2 +- .../Core/test/objectmodel/DataLink_test.cpp | 4 +- .../Core/test/objectmodel/SingleLink_test.cpp | 2 +- .../Helper/simutest/AdvancedTimer_test.cpp | 2 +- .../framework/Helper/test/io/MeshOBJ_test.cpp | 4 +- .../Helper/test/io/STBImage_test.cpp | 4 +- .../Helper/test/io/XspLoader_test.cpp | 4 +- .../Helper/test/system/PluginManager_test.cpp | 4 +- .../BaseMatrix_test.h | 4 +- .../Graph/test/MutationListener_test.cpp | 4 +- .../simutest/parallel_scenes_test.cpp | 44 +++++++++---------- .../Testing/src/sofa/testing/BaseTest.cpp | 4 +- .../Testing/src/sofa/testing/BaseTest.h | 10 ++++- .../Testing/src/sofa/testing/config.h.in | 17 +++++++ Sofa/framework/Type/test/MatSym_test.cpp | 2 +- .../CImgPlugin_test/ImageCImg_test.cpp | 4 +- .../SceneCreator_test/SceneCreator_test.cpp | 2 +- .../SofaCarving_test/SofaCarving_test.cpp | 5 ++- .../image/image_test/DataImage_test.cpp | 2 +- .../image/image_test/ImageEngine_test.cpp | 2 +- .../SceneChecking/tests/SceneChecker_test.cpp | 2 +- .../runSofa/runSofa_test/runSofa_test.cpp | 4 +- 83 files changed, 172 insertions(+), 152 deletions(-) diff --git a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp index 5bc4208c23b..e4f11276c8d 100644 --- a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp +++ b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp @@ -74,13 +74,13 @@ class TestCollisionPipeline : public BaseSimulationTest { void checkCollisionPipelineWithMissingContactManager(); int checkCollisionPipelineWithMonkeyValueForDepth(int value); - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Collision); } - void TearDown() override + void doTearDown() override { if (root) sofa::simulation::node::unload(root); diff --git a/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp b/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp index 835875e7051..80fd33fa464 100644 --- a/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp @@ -54,12 +54,12 @@ namespace { struct TestLocalMinDistance : public BaseSimulationTest { - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Collision.Detection.Intersection); } - void TearDown() override + void doTearDown() override { } diff --git a/Sofa/Component/Collision/Geometry/tests/Sphere_test.cpp b/Sofa/Component/Collision/Geometry/tests/Sphere_test.cpp index 97bd2249d8d..03caeae5d99 100644 --- a/Sofa/Component/Collision/Geometry/tests/Sphere_test.cpp +++ b/Sofa/Component/Collision/Geometry/tests/Sphere_test.cpp @@ -70,7 +70,7 @@ namespace sofa { struct TestSphere : public BaseSimulationTest { - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Collision.Geometry); @@ -79,7 +79,7 @@ struct TestSphere : public BaseSimulationTest m_proxIntersection->setAlarmDistance(1.0); m_proxIntersection->setContactDistance(1.0); } - void TearDown() override + void doTearDown() override { } diff --git a/Sofa/Component/Collision/Geometry/tests/Triangle_test.cpp b/Sofa/Component/Collision/Geometry/tests/Triangle_test.cpp index 7355c123372..e6f8567a262 100644 --- a/Sofa/Component/Collision/Geometry/tests/Triangle_test.cpp +++ b/Sofa/Component/Collision/Geometry/tests/Triangle_test.cpp @@ -56,10 +56,10 @@ namespace sofa { struct TestTriangle : public BaseTest { - void SetUp() override + void doSetUp() override { } - void TearDown() override + void doTearDown() override { } diff --git a/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp index d32ea2d552f..4b4f258cb12 100644 --- a/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp @@ -70,7 +70,7 @@ struct AffineMovementProjectiveConstraint_test : public BaseSimulationTest, Nume sofa::helper::RandomGenerator randomGenerator; // Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); diff --git a/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp index 39e6f6b3ee3..d599139cb25 100644 --- a/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp @@ -69,7 +69,7 @@ struct DirectionProjectiveConstraint_test : public BaseSimulationTest, NumericTe typename MechanicalObject::SPtr dofs; /// Create the context for the tests. - void SetUp() override + void doSetUp() override { //Init simulation = sofa::simulation::getSimulation(); @@ -219,7 +219,7 @@ struct DirectionProjectiveConstraint_test : public BaseSimulationTest, NumericTe return succeed; } - void TearDown() override + void doTearDown() override { if (root!=nullptr) sofa::simulation::node::unload(root); diff --git a/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp index 37f7d55f030..07e2dc61dc7 100644 --- a/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp @@ -68,7 +68,7 @@ struct LineProjectiveConstraint_test : public BaseSimulationTest, NumericTest::SPtr m_mecaobject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp b/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp index 6e109a7ae48..b57ca438e54 100644 --- a/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp +++ b/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp @@ -57,7 +57,7 @@ struct ClusteringEngine_test : public BaseSimulationTest, typename MechanicalObject::SPtr m_mecaobject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp b/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp index be297368933..c7a2fdd853c 100644 --- a/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp @@ -55,7 +55,7 @@ struct ExtrudeEdgesAndGenerateQuads_test : public BaseSimulationTest, Node::SPtr m_node; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp b/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp index 0e101c6440f..5f50d949e1f 100644 --- a/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp @@ -49,7 +49,7 @@ struct MergePoints_test : public BaseSimulationTest, Simulation* m_simu; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp b/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp index 8054de5d1db..08425f2c4cb 100644 --- a/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp @@ -70,7 +70,7 @@ struct BoxROITest : public sofa::testing::BaseTest Node::SPtr m_node; typename TheBoxROI::SPtr m_boxroi; - void onSetUp() override + void doSetUp() override { this->loadPlugins({ Sofa.Component.StateContainer, @@ -87,7 +87,7 @@ struct BoxROITest : public sofa::testing::BaseTest m_node->addObject(m_boxroi); } - void onTearDown() override + void doTearDown() override { if (m_root != nullptr){ sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp b/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp index 38b1dcc0057..ec055b0321a 100644 --- a/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp @@ -55,7 +55,7 @@ struct ComplementaryROI_test : public BaseSimulationTest, typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp index fca7511b4a8..1ebd9f92505 100644 --- a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp @@ -61,7 +61,7 @@ struct MeshROI_test : public BaseSimulationTest, Node::SPtr m_root; ThisClass* m_thisObject; - void SetUp() override + void doSetUp() override { simpleapi::importPlugin(Sofa.Component.Engine.Select); simpleapi::importPlugin(Sofa.Component.Topology.Container.Constant); @@ -86,7 +86,7 @@ struct MeshROI_test : public BaseSimulationTest, ASSERT_NE(m_thisObject, nullptr) ; } - void TearDown() override + void doTearDown() override { sofa::simulation::node::unload(m_root) ; } diff --git a/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp b/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp index 7b86f165312..4ce112798ff 100644 --- a/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp +++ b/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp @@ -31,7 +31,7 @@ struct MeshSubsetEngine_test : public testing::BaseSimulationTest sofa::simulation::Node::SPtr m_root; typename component::engine::select::MeshSubsetEngine<_DataTypes>::SPtr m_engine; - void SetUp() override + void doSetUp() override { simpleapi::importPlugin(Sofa.Component.Engine.Select); @@ -44,7 +44,7 @@ struct MeshSubsetEngine_test : public testing::BaseSimulationTest m_root->addObject(m_engine); } - void TearDown() override + void doTearDown() override { sofa::simulation::node::unload(m_root) ; } diff --git a/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp b/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp index 8ed1acd210f..628d8b97771 100644 --- a/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp @@ -61,7 +61,7 @@ struct PlaneROI_test : public BaseSimulationTest, Node::SPtr m_node1, m_node2; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { // SetUp1 m_simu = sofa::simulation::getSimulation(); diff --git a/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp b/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp index 3033378429f..0bfb8a12387 100644 --- a/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp @@ -61,7 +61,7 @@ struct SphereROI_test : public BaseSimulationTest, Node::SPtr m_node; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp index caf5d3c7bdd..d2f7ecddbbd 100644 --- a/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp @@ -54,7 +54,7 @@ struct DifferenceEngine_test : public BaseSimulationTest, Node::SPtr m_node; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp index f24b09c827c..bbed29b8fa5 100644 --- a/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp @@ -52,7 +52,7 @@ struct DilateEngine_test : public BaseSimulationTest, Node::SPtr m_node; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp index 4d05f03fba7..d28d41321e9 100644 --- a/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp @@ -53,7 +53,7 @@ struct SmoothMeshEngine_test : public BaseSimulationTest, Node::SPtr m_node; typename ThisClass::SPtr m_thisObject; - void SetUp() override + void doSetUp() override { m_simu = sofa::simulation::getSimulation(); ASSERT_NE(m_simu, nullptr); diff --git a/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp index 833bcb0ab05..eb0282269cd 100644 --- a/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp @@ -75,13 +75,13 @@ class MeshExporter_test /// remove the file created... std::vector dataPath; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid); } - void TearDown() override + void doTearDown() override { for (const auto& pathToRemove : dataPath) { diff --git a/Sofa/Component/IO/Mesh/tests/MeshGmshLoader_test.cpp b/Sofa/Component/IO/Mesh/tests/MeshGmshLoader_test.cpp index 93a26d24592..38534751514 100644 --- a/Sofa/Component/IO/Mesh/tests/MeshGmshLoader_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/MeshGmshLoader_test.cpp @@ -51,7 +51,7 @@ namespace meshgmshloader_test /** * Constructor call for each test */ - void SetUp() override {} + void doSetUp() override {} /** * Helper function to check mesh loading. diff --git a/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp index 45dadf6959a..1f8429d1224 100644 --- a/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp @@ -65,14 +65,14 @@ class STLExporter_test : public BaseSimulationTest { /// remove the file created... std::vector dataPath ; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Visual); sofa::simpleapi::importPlugin(Sofa.Component.IO.Mesh); } - void TearDown() override + void doTearDown() override { for (const auto& pathToRemove : dataPath) { diff --git a/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp index 1010d487118..eeb1810bcd0 100644 --- a/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp @@ -62,11 +62,11 @@ class VisualModelOBJExporter_test : public BaseSimulationTest { /// remove the file created... std::vector dataPath ; - void SetUp() override + void doSetUp() override { } - void TearDown() override + void doTearDown() override { for (const auto& pathToRemove : dataPath) { diff --git a/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp b/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp index 668d3719f58..2f923ea9221 100644 --- a/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp +++ b/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp @@ -74,7 +74,7 @@ struct BarycentricMapperTriangleSetTopologyTest : public BaseTest, public Baryc typename Out::VecCoord m_out; TriangleSetTopologyContainer::SPtr m_topology; - void SetUp() override + void doSetUp() override { m_in.push_back(Vec3(0.5, 1.5, 0.0)); m_in.push_back(Vec3(1.5, 0.0, 2.5)); diff --git a/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp b/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp index 630add17ad0..d18e3bbf623 100644 --- a/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp +++ b/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp @@ -74,7 +74,7 @@ struct RigidMappingTest : public sofa::mapping_test::Mapping_test<_RigidMapping> typedef typename OutMechanicalObject::ReadVecCoord ReadOutVecCoord; typedef typename OutMechanicalObject::ReadVecDeriv ReadOutVecDeriv; - void SetUp() override + void doSetUp() override { } diff --git a/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp b/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp index 411a4fc7cd2..f62537fceb7 100644 --- a/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp +++ b/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp @@ -150,7 +150,7 @@ struct SquareDistanceMappingCompare_test : NumericTest simulation::Node::SPtr oneMapping; simulation::Node::SPtr twoMappings; - void onSetUp() override + void doSetUp() override { root = simulation::getSimulation()->createNewNode("root"); diff --git a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp index b2723dc04ac..ca3393caa9c 100644 --- a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp +++ b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp @@ -96,7 +96,7 @@ class DiagonalMass_test : public BaseTest typename MechanicalObject::SPtr mstate; typename DiagonalMass::SPtr mass; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic); sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid); @@ -107,7 +107,7 @@ class DiagonalMass_test : public BaseTest root = simulation::getSimulation()->createNewGraph("root"); } - void TearDown() override + void doTearDown() override { if (root!=nullptr) sofa::simulation::node::unload(root); diff --git a/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp b/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp index eda649530dd..5084b7eb1b2 100644 --- a/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp +++ b/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp @@ -99,7 +99,7 @@ class MeshMatrixMass_test : public BaseTest typename MechanicalObject::SPtr mstate; typename MeshMatrixMass::SPtr mass; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic); sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid); @@ -110,7 +110,7 @@ class MeshMatrixMass_test : public BaseTest root = simulation::getSimulation()->createNewGraph("root"); } - void TearDown() override + void doTearDown() override { if (root!=nullptr) sofa::simulation::node::unload(root); diff --git a/Sofa/Component/Mass/tests/UniformMass_test.cpp b/Sofa/Component/Mass/tests/UniformMass_test.cpp index e4ef516ca76..42243593dca 100644 --- a/Sofa/Component/Mass/tests/UniformMass_test.cpp +++ b/Sofa/Component/Mass/tests/UniformMass_test.cpp @@ -77,7 +77,7 @@ struct UniformMassTest : public BaseTest typename MechanicalObject::SPtr m_mecaobject; bool todo {true} ; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::importPlugin(Sofa.Component.Mass); @@ -87,7 +87,7 @@ struct UniformMassTest : public BaseTest m_root = m_simu->createNewGraph("root"); } - void TearDown() override + void doTearDown() override { if (m_root != nullptr){ sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp b/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp index dc7425b5ce8..8785f12c84b 100644 --- a/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp +++ b/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp @@ -72,7 +72,7 @@ struct ConstantForceField_test : public BaseSimulationTest, NumericTest TheMechanicalObject; using Real = typename DataTypes::Coord::value_type; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.ODESolver); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); @@ -81,7 +81,7 @@ struct ConstantForceField_test : public BaseSimulationTest, NumericTest /// Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); diff --git a/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp b/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp index dd18b29a65a..868b862de62 100644 --- a/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp @@ -51,7 +51,7 @@ static constexpr SReal l = youngModulus * poissonRatio / ((1.0 + poissonRatio) * class StaticSolverTest : public sofa::testing::BaseTest { public: - void onSetUp() override { + void doSetUp() override { root = getSimulation()->createNewNode("root"); @@ -83,7 +83,7 @@ class StaticSolverTest : public sofa::testing::BaseTest solver = dynamic_cast (s.get()); } - void onTearDown() override { + void doTearDown() override { sofa::simulation::node::unload(root); } diff --git a/Sofa/Component/Playback/tests/WriteState_test.cpp b/Sofa/Component/Playback/tests/WriteState_test.cpp index 909a091c983..d0b92f7f4e8 100644 --- a/Sofa/Component/Playback/tests/WriteState_test.cpp +++ b/Sofa/Component/Playback/tests/WriteState_test.cpp @@ -71,7 +71,7 @@ namespace sofa { double final_expected_value=0.0; /// Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation root = simulation::getSimulation()->createNewGraph("root"); @@ -220,7 +220,7 @@ namespace sofa { /// Unload the scene - void TearDown() override + void doTearDown() override { if (root!=nullptr) sofa::simulation::node::unload(root); @@ -237,26 +237,22 @@ namespace sofa { // Test 1 : write position of a particle falling under gravity (required to use SymplecticSolver TYPED_TEST( WriteState_test , test_write_position) { - this->SetUp(); this->createScene(true); this->initScene(); this->runScene(); ASSERT_TRUE( this->simulation_result_test(true) ); ASSERT_TRUE( this->test_export(true) ); - this->TearDown(); } // Test 2 : write velocity of a particle falling under gravity TYPED_TEST( WriteState_test , test_write_velocity) { - this->SetUp(); this->createScene(false); this->initScene(); this->runScene(); ASSERT_TRUE( this->simulation_result_test(false) ); ASSERT_TRUE( this->test_export(false) ); - this->TearDown(); } } diff --git a/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp b/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp index e9bd07fd345..5d8a3d596af 100644 --- a/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp +++ b/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp @@ -44,7 +44,7 @@ struct AddResourceRepository_test : public BaseSimulationTest sofa::simulation::Node::SPtr m_root; std::string m_testRepoDir; - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component.SceneUtility); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h index 23d4b1ffc11..c5ed72d676e 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h @@ -64,12 +64,12 @@ class BaseTetrahedronFEMForceField_test : public sofa::testing::BaseTest public: - void SetUp() override + void doSetUp() override { m_simulation = sofa::simulation::getSimulation(); } - void TearDown() override + void doTearDown() override { if (m_root != nullptr) sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp index 59bd003f6ca..7edff8e465e 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp @@ -66,13 +66,13 @@ class BeamFEMForceField_test : public BaseTest public: - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component); m_simulation = sofa::simulation::getSimulation(); } - void TearDown() override + void doTearDown() override { if (m_root != nullptr) sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp index ed70fa3c39b..2440c772962 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp @@ -79,12 +79,12 @@ class TriangleFEMForceField_test : public BaseTest public: - void SetUp() override + void doSetUp() override { m_simulation = sofa::simulation::getSimulation(); } - void TearDown() override + void doTearDown() override { if (m_root != nullptr) sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp index 7845bbe38e8..055fb1a9279 100644 --- a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp @@ -74,7 +74,7 @@ struct TetrahedronHyperelasticityFEMForceField_params_test : public BaseSimulati unsigned char flags; ///< testing options. (all by default). To be used with precaution. /// } - void SetUp() override + void doSetUp() override { } diff --git a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp index f68e680790f..5fa2c6b37e2 100644 --- a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp @@ -74,7 +74,7 @@ struct TetrahedronHyperelasticityFEMForceField_scene_test : public BaseSimulatio unsigned char flags; ///< testing options. (all by default). To be used with precaution. /// } - void SetUp() override + void doSetUp() override { } diff --git a/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp b/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp index fcb3e5b0e94..5288e64ee48 100644 --- a/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp +++ b/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp @@ -67,14 +67,14 @@ class TriangularBendingSprings_test : public BaseTest public: - void SetUp() override + void doSetUp() override { m_simulation = sofa::simulation::getSimulation(); sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic); sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid); } - void TearDown() override + void doTearDown() override { if (m_root != nullptr) sofa::simulation::node::unload(m_root); diff --git a/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp b/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp index 270088dbaca..baa7a16efde 100644 --- a/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp +++ b/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp @@ -80,7 +80,7 @@ struct AffinePatch_sofa_test : public sofa::testing::BaseSimulationTest, sofa::t Coord testedTranslation; /// Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); diff --git a/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp b/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp index 6202204e7e1..3db4e9cc08c 100644 --- a/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp +++ b/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp @@ -196,7 +196,7 @@ struct LinearElasticity_test : public sofa::testing::BaseSimulationTest, sofa::t // Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); @@ -281,7 +281,7 @@ struct LinearElasticity_test : public sofa::testing::BaseSimulationTest, sofa::t } return true; } - void TearDown() override + void doTearDown() override { if (tractionStruct.root!=nullptr) sofa::simulation::node::unload(tractionStruct.root); diff --git a/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp b/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp index 19c4cde4a41..c172e8c740e 100644 --- a/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp @@ -63,7 +63,7 @@ struct TetrahedronNumericalIntegration_test : public NumericTest::SPtr geo; // Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); @@ -135,7 +135,7 @@ struct TetrahedronNumericalIntegration_test : public NumericTest::SPtr geo; // Create the context for the scene - void SetUp() override + void doSetUp() override { // Init simulation simulation = sofa::simulation::getSimulation(); @@ -135,7 +135,7 @@ struct TriangleNumericalIntegration_test : public NumericTest displayFlags; diff --git a/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp b/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp index 018a6064405..72092164165 100644 --- a/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp +++ b/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp @@ -53,7 +53,7 @@ using sofa::type::RGBAColor ; class OglLabelTest : public BaseTest { public: - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.GL.Component.Rendering2D); } diff --git a/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp b/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp index f8f9adb6e64..ea821661307 100644 --- a/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp +++ b/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp @@ -60,7 +60,7 @@ int messageInited = initMessage(); class TestClipPlane : public BaseTest { public: - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.GL.Component.Rendering3D); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); diff --git a/Sofa/GL/Component/Shader/tests/LightManager_test.cpp b/Sofa/GL/Component/Shader/tests/LightManager_test.cpp index 672906f07dc..21da2ac3c47 100644 --- a/Sofa/GL/Component/Shader/tests/LightManager_test.cpp +++ b/Sofa/GL/Component/Shader/tests/LightManager_test.cpp @@ -53,7 +53,7 @@ namespace sofa { struct TestLightManager : public BaseTest { - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.GL.Component.Shader); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); diff --git a/Sofa/GL/Component/Shader/tests/Light_test.cpp b/Sofa/GL/Component/Shader/tests/Light_test.cpp index 165e974cb33..2a83d5535a5 100644 --- a/Sofa/GL/Component/Shader/tests/Light_test.cpp +++ b/Sofa/GL/Component/Shader/tests/Light_test.cpp @@ -48,7 +48,7 @@ int messageInited = initMessage(); class TestLight : public BaseTest { public: - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.GL.Component.Shader); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); diff --git a/Sofa/framework/Core/test/DataEngine_test.cpp b/Sofa/framework/Core/test/DataEngine_test.cpp index 55f80bad61d..47b68aa5378 100644 --- a/Sofa/framework/Core/test/DataEngine_test.cpp +++ b/Sofa/framework/Core/test/DataEngine_test.cpp @@ -81,7 +81,7 @@ struct DataEngine_test: public BaseTest { TestEngine engine; - void SetUp() override + void doSetUp() override { engine.init(); } diff --git a/Sofa/framework/Core/test/Engine_test.cpp b/Sofa/framework/Core/test/Engine_test.cpp index 938a70aa950..0f872d3e7f1 100644 --- a/Sofa/framework/Core/test/Engine_test.cpp +++ b/Sofa/framework/Core/test/Engine_test.cpp @@ -47,7 +47,7 @@ struct Engine_test : public BaseTest TestEngine::SPtr engine3; /// Create the engines - void SetUp() override + void doSetUp() override { // Engine 1 engine1 = sofa::core::objectmodel::New(); diff --git a/Sofa/framework/Core/test/TrackedData_test.cpp b/Sofa/framework/Core/test/TrackedData_test.cpp index 39780a56921..91ecdca13e8 100644 --- a/Sofa/framework/Core/test/TrackedData_test.cpp +++ b/Sofa/framework/Core/test/TrackedData_test.cpp @@ -215,7 +215,7 @@ struct DataTrackerEngine_test: public BaseTest static unsigned updateCounter; core::DataTrackerCallback dataTracker; - void SetUp() override + void doSetUp() override { updateCounter = 0; } diff --git a/Sofa/framework/Core/test/objectmodel/BaseObjectDescription_test.cpp b/Sofa/framework/Core/test/objectmodel/BaseObjectDescription_test.cpp index 702eb1f077a..ba7c858d238 100644 --- a/Sofa/framework/Core/test/objectmodel/BaseObjectDescription_test.cpp +++ b/Sofa/framework/Core/test/objectmodel/BaseObjectDescription_test.cpp @@ -29,11 +29,11 @@ using sofa::testing::BaseTest ; struct BaseObjectDescription_test: public BaseTest { - void SetUp() override + void doSetUp() override { } - void TearDown() override + void doTearDown() override { } diff --git a/Sofa/framework/Core/test/objectmodel/DataFileName_test.cpp b/Sofa/framework/Core/test/objectmodel/DataFileName_test.cpp index 29d14e833c3..f37aa678b24 100644 --- a/Sofa/framework/Core/test/objectmodel/DataFileName_test.cpp +++ b/Sofa/framework/Core/test/objectmodel/DataFileName_test.cpp @@ -43,7 +43,7 @@ class DataFileName_test: public BaseTest { DataFileName d_filename; public: - void SetUp() override + void doSetUp() override { DataRepository.addFirstPath( SOFA_TESTING_RESOURCES_DIR ); } diff --git a/Sofa/framework/Core/test/objectmodel/DataLink_test.cpp b/Sofa/framework/Core/test/objectmodel/DataLink_test.cpp index 34cd074c650..f6b020030bf 100644 --- a/Sofa/framework/Core/test/objectmodel/DataLink_test.cpp +++ b/Sofa/framework/Core/test/objectmodel/DataLink_test.cpp @@ -40,7 +40,7 @@ struct DataLink_test: public BaseTest Data dataVec3f; Data dataVec3d; - void SetUp() override + void doSetUp() override { /// Setup the data and create a link between the two data data1.setName("data1"); @@ -50,7 +50,7 @@ struct DataLink_test: public BaseTest data2.setName("dataVec3d"); } - void TearDown() override + void doTearDown() override { data1.unset(); data2.unset(); diff --git a/Sofa/framework/Core/test/objectmodel/SingleLink_test.cpp b/Sofa/framework/Core/test/objectmodel/SingleLink_test.cpp index 1e741f7b646..7ad36dabcd0 100644 --- a/Sofa/framework/Core/test/objectmodel/SingleLink_test.cpp +++ b/Sofa/framework/Core/test/objectmodel/SingleLink_test.cpp @@ -47,7 +47,7 @@ class SingleLink_test: public BaseTest BaseObject::SPtr m_src ; /// Create a link to an object. - void SetUp() override + void doSetUp() override { m_dst = sofa::core::objectmodel::New() ; m_src = sofa::core::objectmodel::New() ; diff --git a/Sofa/framework/Helper/simutest/AdvancedTimer_test.cpp b/Sofa/framework/Helper/simutest/AdvancedTimer_test.cpp index a92b7440451..a7dc021fb53 100644 --- a/Sofa/framework/Helper/simutest/AdvancedTimer_test.cpp +++ b/Sofa/framework/Helper/simutest/AdvancedTimer_test.cpp @@ -40,7 +40,7 @@ namespace sofa { struct AdvancedTimerTest: public BaseSimulationTest { protected: - void onSetUp() override + void doSetUp() override { using namespace sofa::helper; diff --git a/Sofa/framework/Helper/test/io/MeshOBJ_test.cpp b/Sofa/framework/Helper/test/io/MeshOBJ_test.cpp index 8f785fe1706..b673a6e933f 100644 --- a/Sofa/framework/Helper/test/io/MeshOBJ_test.cpp +++ b/Sofa/framework/Helper/test/io/MeshOBJ_test.cpp @@ -32,11 +32,11 @@ namespace sofa { class MeshOBJ_test : public BaseTest { protected: - void SetUp() override + void doSetUp() override { sofa::helper::system::DataRepository.addFirstPath(SOFA_TESTING_RESOURCES_DIR); } - void TearDown() override + void doTearDown() override { sofa::helper::system::DataRepository.removePath(SOFA_TESTING_RESOURCES_DIR); } diff --git a/Sofa/framework/Helper/test/io/STBImage_test.cpp b/Sofa/framework/Helper/test/io/STBImage_test.cpp index df88da8b06a..cd05d8dbc99 100644 --- a/Sofa/framework/Helper/test/io/STBImage_test.cpp +++ b/Sofa/framework/Helper/test/io/STBImage_test.cpp @@ -43,11 +43,11 @@ class STBImage_test : public BaseTest } - void SetUp() override + void doSetUp() override { sofa::helper::system::DataRepository.addFirstPath(STBIMAGETEST_RESOURCES_DIR); } - void TearDown() override + void doTearDown() override { sofa::helper::system::DataRepository.removePath(STBIMAGETEST_RESOURCES_DIR); } diff --git a/Sofa/framework/Helper/test/io/XspLoader_test.cpp b/Sofa/framework/Helper/test/io/XspLoader_test.cpp index c7d1476d54e..eb3acc1574c 100644 --- a/Sofa/framework/Helper/test/io/XspLoader_test.cpp +++ b/Sofa/framework/Helper/test/io/XspLoader_test.cpp @@ -85,11 +85,11 @@ class XspLoader_test : public BaseTest } }; - void SetUp() override + void doSetUp() override { sofa::helper::system::DataRepository.addFirstPath(SOFA_TESTING_RESOURCES_DIR); } - void TearDown() override + void doTearDown() override { sofa::helper::system::DataRepository.removePath(SOFA_TESTING_RESOURCES_DIR); } diff --git a/Sofa/framework/Helper/test/system/PluginManager_test.cpp b/Sofa/framework/Helper/test/system/PluginManager_test.cpp index 7673e8b6445..7d9ebf95dad 100644 --- a/Sofa/framework/Helper/test/system/PluginManager_test.cpp +++ b/Sofa/framework/Helper/test/system/PluginManager_test.cpp @@ -64,7 +64,7 @@ struct PluginManager_test: public BaseTest // This list of paths will be deleted when cleaning-up the test sofa::type::vector createdFilesToDelete; - void SetUp() override + void doSetUp() override { // Set pluginDir by searching pluginFileName in the PluginRepository for ( std::string path : sofa::helper::system::PluginRepository.getPaths() ) @@ -83,7 +83,7 @@ struct PluginManager_test: public BaseTest << std::endl; } - void TearDown() override + void doTearDown() override { for (const auto& file : createdFilesToDelete) { diff --git a/Sofa/framework/LinearAlgebra/Testing/src/Sofa.LinearAlgebra.Testing/BaseMatrix_test.h b/Sofa/framework/LinearAlgebra/Testing/src/Sofa.LinearAlgebra.Testing/BaseMatrix_test.h index c092397e04d..4767da3fe64 100644 --- a/Sofa/framework/LinearAlgebra/Testing/src/Sofa.LinearAlgebra.Testing/BaseMatrix_test.h +++ b/Sofa/framework/LinearAlgebra/Testing/src/Sofa.LinearAlgebra.Testing/BaseMatrix_test.h @@ -47,7 +47,7 @@ class TestBaseMatrix : public sofa::testing::NumericTest static constexpr sofa::Index NbRows = T::NbRows; static constexpr sofa::Index NbCols = T::NbCols; - void onSetUp() override + void doSetUp() override { m_testedMatrix = std::make_unique(); m_testedMatrix->resize(NbRows, NbCols); @@ -55,7 +55,7 @@ class TestBaseMatrix : public sofa::testing::NumericTest m_modelMatrix.clear(); } - void onTearDown() override + void doTearDown() override { m_testedMatrix.reset(); } diff --git a/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp b/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp index 1ffcafa8813..c2d20e7bc9c 100644 --- a/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp +++ b/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp @@ -411,14 +411,14 @@ struct MutationListener_test : public BaseTest listener.log); } - void SetUp() override + void doSetUp() override { sofa::simulation::Simulation* simu = sofa::simulation::getSimulation(); root = simu->createNewGraph("root"); root->addListener(&listener); } - void TearDown() override + void doTearDown() override { } }; diff --git a/Sofa/framework/Simulation/simutest/parallel_scenes_test.cpp b/Sofa/framework/Simulation/simutest/parallel_scenes_test.cpp index 9e0385facb7..5bb847fea9e 100644 --- a/Sofa/framework/Simulation/simutest/parallel_scenes_test.cpp +++ b/Sofa/framework/Simulation/simutest/parallel_scenes_test.cpp @@ -44,31 +44,31 @@ class ParallelScenesTest : public virtual sofa::testing::BaseTest { } - void SetUp() override + void doSetUp() override { EXPECT_MSG_NOEMIT(Error, Warning); - sofa::simpleapi::importPlugin("Sofa.Component.AnimationLoop"); - sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Algorithm"); - sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Intersection"); - sofa::simpleapi::importPlugin("Sofa.Component.Collision.Geometry"); - sofa::simpleapi::importPlugin("Sofa.Component.Collision.Response.Contact"); - sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Lagrangian.Correction"); - sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Lagrangian.Solver"); - sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Projective"); - sofa::simpleapi::importPlugin("Sofa.Component.IO.Mesh"); - sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Iterative"); - sofa::simpleapi::importPlugin("Sofa.Component.Mapping.Linear"); - sofa::simpleapi::importPlugin("Sofa.Component.Mass"); - sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward"); - sofa::simpleapi::importPlugin("Sofa.Component.SolidMechanics.FEM.Elastic"); - sofa::simpleapi::importPlugin("Sofa.Component.StateContainer"); - sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Constant"); - sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic"); - sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Grid"); - sofa::simpleapi::importPlugin("Sofa.Component.Visual"); - sofa::simpleapi::importPlugin("Sofa.GL.Component.Rendering3D"); - sofa::simpleapi::importPlugin("Sofa.Component.LinearSystem"); + sofa::simpleapi::importPlugin(Sofa.Component.AnimationLoop); + sofa::simpleapi::importPlugin(Sofa.Component.Collision.Detection.Algorithm); + sofa::simpleapi::importPlugin(Sofa.Component.Collision.Detection.Intersection); + sofa::simpleapi::importPlugin(Sofa.Component.Collision.Geometry); + sofa::simpleapi::importPlugin(Sofa.Component.Collision.Response.Contact); + sofa::simpleapi::importPlugin(Sofa.Component.Constraint.Lagrangian.Correction); + sofa::simpleapi::importPlugin(Sofa.Component.Constraint.Lagrangian.Solver); + sofa::simpleapi::importPlugin(Sofa.Component.Constraint.Projective); + sofa::simpleapi::importPlugin(Sofa.Component.IO.Mesh); + sofa::simpleapi::importPlugin(Sofa.Component.LinearSolver.Iterative); + sofa::simpleapi::importPlugin(Sofa.Component.Mapping.Linear); + sofa::simpleapi::importPlugin(Sofa.Component.Mass); + sofa::simpleapi::importPlugin(Sofa.Component.ODESolver.Backward); + sofa::simpleapi::importPlugin(Sofa.Component.SolidMechanics.FEM.Elastic); + sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); + sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Constant); + sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic); + sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid); + sofa::simpleapi::importPlugin(Sofa.Component.Visual); + sofa::simpleapi::importPlugin(Sofa.GL.Component.Rendering3D); + sofa::simpleapi::importPlugin(Sofa.Component.LinearSystem); } void executeInParallel(const char* sceneStr, const std::size_t nbScenes, const std::size_t nbSteps) diff --git a/Sofa/framework/Testing/src/sofa/testing/BaseTest.cpp b/Sofa/framework/Testing/src/sofa/testing/BaseTest.cpp index 474fa830b5c..f4c6de7a263 100644 --- a/Sofa/framework/Testing/src/sofa/testing/BaseTest.cpp +++ b/Sofa/framework/Testing/src/sofa/testing/BaseTest.cpp @@ -101,13 +101,13 @@ void BaseTest::loadPlugins( void BaseTest::SetUp() { - onSetUp(); + doSetUp(); } void BaseTest::TearDown() { m_loadedPlugins.clear(); - onTearDown(); + doTearDown(); } diff --git a/Sofa/framework/Testing/src/sofa/testing/BaseTest.h b/Sofa/framework/Testing/src/sofa/testing/BaseTest.h index feb60096065..303421e0ba3 100644 --- a/Sofa/framework/Testing/src/sofa/testing/BaseTest.h +++ b/Sofa/framework/Testing/src/sofa/testing/BaseTest.h @@ -48,7 +48,13 @@ class SOFA_TESTING_API BaseTest : public ::testing::Test BaseTest() ; ~BaseTest() override; + virtual void doSetUp() { onSetUp(); } + virtual void doTearDown() { onTearDown(); } + + SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONSETUP() virtual void onSetUp() {} + + SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONTEARDOWN() virtual void onTearDown() {} /// Seed value @@ -57,8 +63,8 @@ class SOFA_TESTING_API BaseTest : public ::testing::Test void loadPlugins(const std::initializer_list& pluginNames); private: - void SetUp() override ; - void TearDown() override ; + void SetUp() final ; + void TearDown() final ; std::deque m_loadedPlugins; }; diff --git a/Sofa/framework/Testing/src/sofa/testing/config.h.in b/Sofa/framework/Testing/src/sofa/testing/config.h.in index 35221eb58fe..04dedf7c8fb 100644 --- a/Sofa/framework/Testing/src/sofa/testing/config.h.in +++ b/Sofa/framework/Testing/src/sofa/testing/config.h.in @@ -43,3 +43,20 @@ constexpr char SOFA_TESTING_RESOURCES_DIR[] = "@SOFA_TESTING_RESOURCES_DIR@"; SOFA_ATTRIBUTE_DEPRECATED( \ "v24.06", "v24.12", "Use sofa::simpleapi::importPlugin() instead.") #endif // SOFA_BUILD_SOFA_TESTING + + +#ifdef SOFA_BUILD_SOFA_TESTING +#define SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONSETUP() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONSETUP() \ + SOFA_ATTRIBUTE_DEPRECATED( \ + "v25.06", "v25.12", "Use doSetUp instead.") +#endif // SOFA_BUILD_SOFA_TESTING + +#ifdef SOFA_BUILD_SOFA_TESTING +#define SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONTEARDOWN() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__TESTING_ONTEARDOWN() \ + SOFA_ATTRIBUTE_DEPRECATED( \ + "v25.06", "v25.12", "Use doTearDown instead.") +#endif // SOFA_BUILD_SOFA_TESTING diff --git a/Sofa/framework/Type/test/MatSym_test.cpp b/Sofa/framework/Type/test/MatSym_test.cpp index f91f864460a..6e7926f3766 100644 --- a/Sofa/framework/Type/test/MatSym_test.cpp +++ b/Sofa/framework/Type/test/MatSym_test.cpp @@ -43,7 +43,7 @@ class MatSymTest : public testing::NumericTest using Real = typename ParameterPack::Real; static constexpr auto Size = ParameterPack::Size; - void onSetUp() override + void doSetUp() override { sofa::testing::LinearCongruentialRandomGenerator lcg(96547); diff --git a/applications/plugins/CImgPlugin/CImgPlugin_test/ImageCImg_test.cpp b/applications/plugins/CImgPlugin/CImgPlugin_test/ImageCImg_test.cpp index f830e0834de..20b2be44f5a 100644 --- a/applications/plugins/CImgPlugin/CImgPlugin_test/ImageCImg_test.cpp +++ b/applications/plugins/CImgPlugin/CImgPlugin_test/ImageCImg_test.cpp @@ -42,11 +42,11 @@ class ImageCImg_test : public BaseTest } - void SetUp() override + void doSetUp() override { sofa::helper::system::DataRepository.addFirstPath(CIMGPLUGIN_RESOURCES_DIR); } - void TearDown() override + void doTearDown() override { sofa::helper::system::DataRepository.removePath(CIMGPLUGIN_RESOURCES_DIR); } diff --git a/applications/plugins/SceneCreator/SceneCreator_test/SceneCreator_test.cpp b/applications/plugins/SceneCreator/SceneCreator_test/SceneCreator_test.cpp index cc97a19ab38..5fc3bdbb1ab 100644 --- a/applications/plugins/SceneCreator/SceneCreator_test/SceneCreator_test.cpp +++ b/applications/plugins/SceneCreator/SceneCreator_test/SceneCreator_test.cpp @@ -58,7 +58,7 @@ using sofa::simulation::Node; class SceneCreator_test : public BaseSimulationTest { public: - void SetUp() override + void doSetUp() override { sofa::simpleapi::importPlugin(Sofa.Component); sofa::simpleapi::importPlugin(Sofa.GL.Component.Rendering3D); diff --git a/applications/plugins/SofaCarving/SofaCarving_test/SofaCarving_test.cpp b/applications/plugins/SofaCarving/SofaCarving_test/SofaCarving_test.cpp index 1424f4cca7f..5e8eef63918 100644 --- a/applications/plugins/SofaCarving/SofaCarving_test/SofaCarving_test.cpp +++ b/applications/plugins/SofaCarving/SofaCarving_test/SofaCarving_test.cpp @@ -61,9 +61,10 @@ class SofaCarving_test : public BaseSimulationTest void doCarvingWithPenetration(); /// Unload the scene - void TearDown() override + void doTearDown() override { - if (m_simu != nullptr && m_root != nullptr) { + if (m_root != nullptr) + { sofa::simulation::node::unload(m_root); } } diff --git a/applications/plugins/image/image_test/DataImage_test.cpp b/applications/plugins/image/image_test/DataImage_test.cpp index 76ef76c395a..ce749b58a7d 100644 --- a/applications/plugins/image/image_test/DataImage_test.cpp +++ b/applications/plugins/image/image_test/DataImage_test.cpp @@ -45,7 +45,7 @@ struct DataImageLink_test : public sofa::testing::BaseTest core::objectmodel::Data< defaulttype::Image > data2; /// Create a link between the two images - void SetUp() + void doSetUp() { } diff --git a/applications/plugins/image/image_test/ImageEngine_test.cpp b/applications/plugins/image/image_test/ImageEngine_test.cpp index 7890e89d929..dcae5fee3d9 100644 --- a/applications/plugins/image/image_test/ImageEngine_test.cpp +++ b/applications/plugins/image/image_test/ImageEngine_test.cpp @@ -51,7 +51,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest simulation::Node::SPtr root; // Unload scene - void TearDown() + void doTearDown() { if (root!=NULL) sofa::simulation::node::unload(root); diff --git a/applications/projects/SceneChecking/tests/SceneChecker_test.cpp b/applications/projects/SceneChecking/tests/SceneChecker_test.cpp index 2d6111bf964..1324a6773c1 100644 --- a/applications/projects/SceneChecking/tests/SceneChecker_test.cpp +++ b/applications/projects/SceneChecking/tests/SceneChecker_test.cpp @@ -76,7 +76,7 @@ int ComponentDeprecatedClassId = sofa::core::RegisterObject("") //////////////////////////////////////////////////////////////////////////////////////////////////// struct SceneChecker_test : public BaseSimulationTest { - void SetUp() override + void doSetUp() override { } diff --git a/applications/projects/runSofa/runSofa_test/runSofa_test.cpp b/applications/projects/runSofa/runSofa_test/runSofa_test.cpp index 70fb826b39e..7d0607e198e 100644 --- a/applications/projects/runSofa/runSofa_test/runSofa_test.cpp +++ b/applications/projects/runSofa/runSofa_test/runSofa_test.cpp @@ -44,7 +44,7 @@ class runSofa_test : public sofa::testing::BaseTest } - void SetUp() override + void doSetUp() override { const std::string& pluginDir = PluginRepository.getFirstPath(); @@ -58,7 +58,7 @@ class runSofa_test : public sofa::testing::BaseTest testPluginList << m_testPluginName << std::endl; testPluginList.close(); } - void TearDown() override + void doTearDown() override { }