Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <ros/ros.h>
00032
00033 #include <gtest/gtest.h>
00034
00035 #include <interactive_markers/interactive_marker_server.h>
00036
00037 TEST(InteractiveMarkerServer, addRemove)
00038 {
00039
00040 interactive_markers::InteractiveMarkerServer server("im_server_test");
00041
00042
00043 visualization_msgs::InteractiveMarker int_marker;
00044 int_marker.name = "marker1";
00045
00046
00047 geometry_msgs::Pose pose;
00048 pose.orientation.w = 1.0;
00049
00050
00051 server.insert(int_marker);
00052 ASSERT_TRUE( server.get("marker1", int_marker) );
00053
00054 server.applyChanges();
00055 ASSERT_TRUE( server.get("marker1", int_marker) );
00056
00057 server.erase( "marker1" );
00058 ASSERT_FALSE( server.get("marker1", int_marker) );
00059
00060 server.applyChanges();
00061 ASSERT_FALSE( server.get("marker1", int_marker) );
00062
00063
00064
00065 server.insert(int_marker);
00066 ASSERT_TRUE( server.get("marker1", int_marker) );
00067
00068 server.erase( "marker1" );
00069 ASSERT_FALSE( server.get("marker1", int_marker) );
00070
00071 server.applyChanges();
00072 ASSERT_FALSE( server.get("marker1", int_marker) );
00073
00074
00075 server.insert(int_marker);
00076 ASSERT_TRUE( server.get("marker1", int_marker) );
00077
00078 server.applyChanges();
00079 ASSERT_TRUE( server.get("marker1", int_marker) );
00080
00081 server.clear();
00082 ASSERT_FALSE( server.get("marker1", int_marker) );
00083
00084 server.applyChanges();
00085 ASSERT_FALSE( server.get("marker1", int_marker) );
00086
00087
00088 server.insert(int_marker);
00089 ASSERT_TRUE( server.setPose("marker1", pose) );
00090
00091 server.applyChanges();
00092 server.clear();
00093 ASSERT_FALSE( server.get("marker1", int_marker) );
00094
00095 server.applyChanges();
00096
00097
00098 usleep(1000);
00099 }
00100
00101
00102
00103 int main(int argc, char **argv)
00104 {
00105 ros::init(argc, argv, "im_server_test");
00106 testing::InitGoogleTest(&argc, argv);
00107 return RUN_ALL_TESTS();
00108 }