test_util.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 from nose.tools import assert_equal
00005 
00006 from roslib.message import get_message_class
00007 from jsk_rqt_plugins.util import get_slot_type_field_names
00008 
00009 
00010 def test_get_slot_type_field_names():
00011     # test for type as slot_type
00012     msg = get_message_class('jsk_rviz_plugins/OverlayText')
00013     field_names = get_slot_type_field_names(msg, slot_type='string')
00014     assert_equal(field_names, ['/font', '/text'])
00015     # test for msg as slot_type
00016     field_names = get_slot_type_field_names(msg,
00017                                             slot_type='std_msgs/ColorRGBA')
00018     assert_equal(field_names, ['/bg_color', '/fg_color'])
00019     # test for type array
00020     msg = get_message_class('jsk_recognition_msgs/Histogram')
00021     field_names = get_slot_type_field_names(msg, slot_type='float64[]')
00022     assert_equal(field_names, ['/histogram'])
00023     # test for msg array
00024     msg = get_message_class('diagnostic_msgs/DiagnosticArray')
00025     field_names = get_slot_type_field_names(msg, slot_type='string')
00026     assert_equal(field_names, ['/header/frame_id', '/status[]/name',
00027                                '/status[]/message', '/status[]/hardware_id',
00028                                '/status[]/values[]/key',
00029                                '/status[]/values[]/value'])


jsk_rqt_plugins
Author(s):
autogenerated on Sun Sep 13 2015 22:29:48