diff --git a/panther_manager/test/plugins/condition/test_check_joy_msg.cpp b/panther_manager/test/plugins/condition/test_check_joy_msg.cpp index 40e209e9..f286666e 100644 --- a/panther_manager/test/plugins/condition/test_check_joy_msg.cpp +++ b/panther_manager/test/plugins/condition/test_check_joy_msg.cpp @@ -50,11 +50,7 @@ class TestCheckJoyMsg : public panther_manager::plugin_test_utils::PluginTestUti JoyMsg CreateMsg( const std::vector & axes = {}, const std::vector & buttons = {}, const HeaderMsg & header = HeaderMsg()); - void SetCurrentHeaderTime(HeaderMsg & header) - { - header.stamp.sec = bt_node_->now().seconds(); - header.stamp.nanosec = bt_node_->now().nanoseconds(); - } + void SetCurrentMsgTime(JoyMsg & header); protected: rclcpp::Publisher::SharedPtr joy_publisher_; @@ -76,6 +72,12 @@ JoyMsg TestCheckJoyMsg::CreateMsg( return msg; } +void TestCheckJoyMsg::SetCurrentMsgTime(JoyMsg & msg) +{ + msg.header.stamp.sec = bt_node_->now().seconds(); + msg.header.stamp.nanosec = bt_node_->now().nanoseconds(); +} + TEST_F(TestCheckJoyMsg, NoTopicSet) { bt_ports input = {{"topic_name", ""}, {"axes", "0;0"}, {"buttons", "0;0"}, {"timeout", "1.0"}}; @@ -109,10 +111,8 @@ TEST_F(TestCheckJoyMsg, TimeoutTests) CreateMsg()}}; for (auto & test_case : test_cases) { - SCOPED_TRACE("Test case name: " + test_case.name); - CreateTree(PLUGIN, test_case.input); - SetCurrentHeaderTime(test_case.msg.header); + SetCurrentMsgTime(test_case.msg); std::this_thread::sleep_for(std::chrono::milliseconds(2)); PublishMsg(test_case.msg); @@ -177,7 +177,7 @@ TEST_F(TestCheckJoyMsg, OnTickBehavior) for (auto & test_case : test_cases) { CreateTree(PLUGIN, test_case.input); - SetCurrentHeaderTime(test_case.msg.header); + SetCurrentMsgTime(test_case.msg); PublishMsg(test_case.msg); auto & tree = GetTree();