From 08ceb17f53627990f03b605ee0950ca1220da2ff Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Tue, 19 Dec 2023 09:03:38 +0100 Subject: [PATCH] Remove use of deprecated functions (#253) --- .../constraint/SurfacePressureConstraintTest.cpp | 3 --- .../constraint/UnilateralPlaneConstraintTest.cpp | 8 +++----- .../controller/DataVariationLimiterTest.cpp | 4 +--- .../controller/SerialPortBridgeGenericTest.cpp | 4 +--- .../component/engine/VolumeFromTetrahedronsTest.cpp | 13 ++++--------- tests/component/engine/VolumeFromTrianglesTest.cpp | 10 ++-------- 6 files changed, 11 insertions(+), 31 deletions(-) diff --git a/tests/component/constraint/SurfacePressureConstraintTest.cpp b/tests/component/constraint/SurfacePressureConstraintTest.cpp index adb3c79c..12c94a5a 100644 --- a/tests/component/constraint/SurfacePressureConstraintTest.cpp +++ b/tests/component/constraint/SurfacePressureConstraintTest.cpp @@ -64,7 +64,6 @@ namespace softrobots { using SurfacePressureConstraint<_DataTypes>::d_componentState; sofa::simulation::Node::SPtr m_root; ///< Root of the scene graph, created by the constructor an re-used in the tests - sofa::simulation::Simulation* m_simulation; ///< created by the constructor an re-used in the tests typedef _DataTypes DataTypes; typedef typename DataTypes::Deriv Deriv; @@ -83,8 +82,6 @@ namespace softrobots { { sofa::simpleapi::importPlugin("Sofa.Component"); - sofa::simulation::setSimulation(m_simulation = new sofa::simulation::graph::DAGSimulation()); - /// Load the scene string sceneName = "SurfacePressureConstraint.scn"; diff --git a/tests/component/constraint/UnilateralPlaneConstraintTest.cpp b/tests/component/constraint/UnilateralPlaneConstraintTest.cpp index a4095068..42de4217 100644 --- a/tests/component/constraint/UnilateralPlaneConstraintTest.cpp +++ b/tests/component/constraint/UnilateralPlaneConstraintTest.cpp @@ -88,11 +88,9 @@ struct UnilateralPlaneConstraintTest : public sofa::testing::BaseTest, ///////////////////////////////////////////////////////////////////// - void normalTests(){ - Simulation* simu; - setSimulation(simu = new sofa::simulation::graph::DAGSimulation()); - - Node::SPtr node = simu->createNewGraph("root"); + void normalTests() + { + const Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); typename MechanicalObject::SPtr mecaobject = New >() ; typename ThisClass::SPtr thisobject = New() ; diff --git a/tests/component/controller/DataVariationLimiterTest.cpp b/tests/component/controller/DataVariationLimiterTest.cpp index fa58ecbf..459fc017 100644 --- a/tests/component/controller/DataVariationLimiterTest.cpp +++ b/tests/component/controller/DataVariationLimiterTest.cpp @@ -72,13 +72,11 @@ struct DataVariationLimiterTest : public sofa::testing::BaseTest, DataVariationL /////////////////////////////////////////////////////////////// - Simulation* m_simu; Node::SPtr m_node; void SetUp() { - setSimulation(m_simu = new sofa::simulation::graph::DAGSimulation()); - m_node = m_simu->createNewGraph("root"); + m_node = sofa::simulation::getSimulation()->createNewGraph("root"); } void normalTests(){ diff --git a/tests/component/controller/SerialPortBridgeGenericTest.cpp b/tests/component/controller/SerialPortBridgeGenericTest.cpp index 2fed447c..c3485ae2 100644 --- a/tests/component/controller/SerialPortBridgeGenericTest.cpp +++ b/tests/component/controller/SerialPortBridgeGenericTest.cpp @@ -80,13 +80,11 @@ struct SerialPortBridgeGenericTest : public sofa::testing::BaseTest, SerialPortB /////////////////////////////////////////////////////////////// - Simulation* m_simu; Node::SPtr m_node; void SetUp() { - setSimulation(m_simu = new sofa::simulation::graph::DAGSimulation()); - m_node = m_simu->createNewGraph("root"); + m_node = sofa::simulation::getSimulation()->createNewGraph("root"); } void normalTests(){ diff --git a/tests/component/engine/VolumeFromTetrahedronsTest.cpp b/tests/component/engine/VolumeFromTetrahedronsTest.cpp index a0a259c3..23032f8d 100644 --- a/tests/component/engine/VolumeFromTetrahedronsTest.cpp +++ b/tests/component/engine/VolumeFromTetrahedronsTest.cpp @@ -90,11 +90,9 @@ struct VolumeFromTetrahedronsTest : public sofa::testing::BaseTest, VolumeFromTe /////////////////////////////////////////////////////////////// - void normalTests(){ - Simulation* simu; - setSimulation(simu = new sofa::simulation::graph::DAGSimulation()); - - Node::SPtr node = simu->createNewGraph("root"); + void normalTests() + { + const Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); typename MechanicalObject::SPtr mecaobject = New >() ; typename ThisClass::SPtr thisobject = New() ; mecaobject->init() ; @@ -126,10 +124,7 @@ struct VolumeFromTetrahedronsTest : public sofa::testing::BaseTest, VolumeFromTe { DataRepository.addFirstPath(SOFTROBOTS_TEST_DIR); - Simulation* simu; - setSimulation(simu = new sofa::simulation::graph::DAGSimulation()); - - Node::SPtr node = simu->createNewGraph("root"); + const Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); typename TetrahedronSetTopologyContainer::SPtr mesh = New< TetrahedronSetTopologyContainer >() ; typename MechanicalObject::SPtr mecaobject = New< MechanicalObject >() ; diff --git a/tests/component/engine/VolumeFromTrianglesTest.cpp b/tests/component/engine/VolumeFromTrianglesTest.cpp index 9c17d442..3d3646d7 100644 --- a/tests/component/engine/VolumeFromTrianglesTest.cpp +++ b/tests/component/engine/VolumeFromTrianglesTest.cpp @@ -92,10 +92,7 @@ struct VolumeFromTrianglesTest : public sofa::testing::BaseTest, VolumeFromTrian void normalTests() { - Simulation* simu; - setSimulation(simu = new sofa::simulation::graph::DAGSimulation()); - - Node::SPtr node = simu->createNewGraph("root"); + Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); typename MechanicalObject::SPtr mecaobject = New >() ; typename ThisClass::SPtr thisobject = New() ; mecaobject->init() ; @@ -129,10 +126,7 @@ struct VolumeFromTrianglesTest : public sofa::testing::BaseTest, VolumeFromTrian { DataRepository.addFirstPath(SOFTROBOTS_TEST_DIR); - Simulation* simu; - setSimulation(simu = new sofa::simulation::graph::DAGSimulation()); - - Node::SPtr node = simu->createNewGraph("root"); + Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); typename MeshTopology::SPtr mesh = New< MeshTopology >() ; typename MechanicalObject::SPtr mecaobject = New< MechanicalObject >() ;