test_util.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 from nose.tools import assert_equal
5 
6 from roslib.message import get_message_class
7 from jsk_rqt_plugins.util import get_slot_type_field_names
8 
9 
11  # test for type as slot_type
12  msg = get_message_class('jsk_rviz_plugins/OverlayText')
13  field_names = get_slot_type_field_names(msg, slot_type='string')
14  assert_equal(field_names, ['/font', '/text'])
15  # test for msg as slot_type
16  field_names = get_slot_type_field_names(msg,
17  slot_type='std_msgs/ColorRGBA')
18  assert_equal(field_names, ['/bg_color', '/fg_color'])
19  # test for type array
20  msg = get_message_class('jsk_recognition_msgs/Histogram')
21  field_names = get_slot_type_field_names(msg, slot_type='float64[]')
22  assert_equal(field_names, ['/histogram'])
23  # test for msg array
24  msg = get_message_class('diagnostic_msgs/DiagnosticArray')
25  field_names = get_slot_type_field_names(msg, slot_type='string')
26  assert_equal(field_names, ['/header/frame_id', '/status[]/name',
27  '/status[]/message', '/status[]/hardware_id',
28  '/status[]/values[]/key',
29  '/status[]/values[]/value'])
def get_slot_type_field_names(msg, slot_type, field_name=None, found=None)
Definition: util.py:7
def test_get_slot_type_field_names()
Definition: test_util.py:10


jsk_rqt_plugins
Author(s):
autogenerated on Fri Feb 5 2021 04:03:20