Skip to content

Commit d11e0b3

Browse files
committed
use ScopedPlugin in a test as an example
1 parent 17deee0 commit d11e0b3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Sofa/Component/LinearSolver/Direct/tests/SparseLDLSolver_test.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ TEST(SparseLDLSolver, EmptyMState)
5757

5858
const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root");
5959

60-
sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Direct");
61-
sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward");
62-
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
60+
const auto plugins = sofa::testing::makeScopedPlugin({
61+
"Sofa.Component.LinearSolver.Direct",
62+
"Sofa.Component.ODESolver.Backward",
63+
"Sofa.Component.StateContainer"});
6364

6465
sofa::simpleapi::createObject(root, "DefaultAnimationLoop");
6566
sofa::simpleapi::createObject(root, "EulerImplicitSolver");
@@ -83,14 +84,15 @@ TEST(SparseLDLSolver, TopologyChangeEmptyMState)
8384
// required to be able to use EXPECT_MSG_NOEMIT and EXPECT_MSG_EMIT
8485
sofa::helper::logging::MessageDispatcher::addHandler(sofa::testing::MainGtestMessageHandler::getInstance() ) ;
8586

86-
const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root");
87+
const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root");
8788

88-
sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Direct");
89-
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
90-
sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward");
91-
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
92-
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
93-
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Utility");
89+
const auto plugins = sofa::testing::makeScopedPlugin({
90+
"Sofa.Component.LinearSolver.Direct",
91+
"Sofa.Component.Mass",
92+
"Sofa.Component.ODESolver.Backward",
93+
"Sofa.Component.StateContainer",
94+
"Sofa.Component.Topology.Container.Dynamic",
95+
"Sofa.Component.Topology.Utility"});
9496

9597
sofa::simpleapi::createObject(root, "DefaultAnimationLoop");
9698
sofa::simpleapi::createObject(root, "EulerImplicitSolver");

0 commit comments

Comments
 (0)