From 6cb6b64e74b344d51c9c75bdb82df19446ff6a9a Mon Sep 17 00:00:00 2001 From: satoshi-ota Date: Tue, 8 Oct 2024 08:20:10 +0900 Subject: [PATCH] test: add test Signed-off-by: satoshi-ota --- .../CMakeLists.txt | 22 ++++++++++++++++--- .../test/test_screen_capture_panel.cpp | 21 ++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 common/tier4_screen_capture_rviz_plugin/test/test_screen_capture_panel.cpp diff --git a/common/tier4_screen_capture_rviz_plugin/CMakeLists.txt b/common/tier4_screen_capture_rviz_plugin/CMakeLists.txt index c8d185dd9..2cd175836 100644 --- a/common/tier4_screen_capture_rviz_plugin/CMakeLists.txt +++ b/common/tier4_screen_capture_rviz_plugin/CMakeLists.txt @@ -26,9 +26,25 @@ ament_auto_add_library(${PROJECT_NAME}_lib SHARED src/screen_capture_panel.cpp ) -rosidl_get_typesupport_target( - cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp") -target_link_libraries(${PROJECT_NAME}_lib "${cpp_typesupport_target}") +if(${rosidl_cmake_VERSION} VERSION_LESS 2.5.0) + rosidl_target_interfaces(${PROJECT_NAME}_lib + ${PROJECT_NAME} "rosidl_typesupport_cpp") +else() + rosidl_get_typesupport_target( + cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp") + target_link_libraries(${PROJECT_NAME}_lib "${cpp_typesupport_target}") +endif() + +if(BUILD_TESTING) + ament_add_ros_isolated_gtest(test_${PROJECT_NAME} + test/test_screen_capture_panel.cpp + ) + target_link_libraries(test_${PROJECT_NAME} + gtest_main + ${PROJECT_NAME}_lib + ) + target_include_directories(test_${PROJECT_NAME} PRIVATE src) +endif() target_link_libraries(${PROJECT_NAME}_lib ${QT_LIBRARIES} diff --git a/common/tier4_screen_capture_rviz_plugin/test/test_screen_capture_panel.cpp b/common/tier4_screen_capture_rviz_plugin/test/test_screen_capture_panel.cpp new file mode 100644 index 000000000..b97a1ca5d --- /dev/null +++ b/common/tier4_screen_capture_rviz_plugin/test/test_screen_capture_panel.cpp @@ -0,0 +1,21 @@ +// Copyright 2024 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "../src/screen_capture_panel.hpp" + +#include + +TEST(AutowareScreenCapturePanelTest, foo) +{ +}