test_rqt_ros_graph.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 
00003 # Software License Agreement (BSD License)
00004 #
00005 # Copyright (c) 2012, Willow Garage, Inc.
00006 # All rights reserved.
00007 #
00008 # Redistribution and use in source and binary forms, with or without
00009 # modification, are permitted provided that the following conditions
00010 # are met:
00011 #
00012 # * Redistributions of source code must retain the above copyright
00013 # notice, this list of conditions and the following disclaimer.
00014 # * Redistributions in binary form must reproduce the above
00015 # copyright notice, this list of conditions and the following
00016 # disclaimer in the documentation and/or other materials provided
00017 # with the distribution.
00018 # * Neither the name of Willow Garage, Inc. nor the names of its
00019 # contributors may be used to endorse or promote products derived
00020 # from this software without specific prior written permission.
00021 #
00022 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033 # POSSIBILITY OF SUCH DAMAGE.
00034 #
00035 # Author: Isaac Saito
00036 
00037 import unittest
00038 
00039 from python_qt_binding.QtGui import QStandardItem, QStandardItemModel
00040 from rqt_reconfigure.rqt_ros_graph import RqtRosGraph
00041 
00042 
00043 class TestRqtRosGraph(unittest.TestCase):
00044     """
00045     :author: Isaac Saito
00046     """
00047 
00048     def setUp(self):
00049         unittest.TestCase.setUp(self)
00050 
00051         self._model = QStandardItemModel()
00052         node1 = QStandardItem('node1')
00053         self._node1_1 = QStandardItem('node1_1')
00054         self._node1_1_1 = QStandardItem('node1_1_1')
00055         node1_1_2 = QStandardItem('node1_1_2')
00056         node1_2 = QStandardItem('node1_2')
00057 
00058         node1.appendRow(self._node1_1)
00059         self._node1_1.appendRow(self._node1_1_1)
00060         self._node1_1.appendRow(node1_1_2)
00061         node1.appendRow(node1_2)
00062 
00063         self._model.appendRow(node1)
00064 
00065         #node_list = [node1, node1_1, self._node1_1_1, node1_1_2, node1_2]
00066         #self._model.appendRow(node_list)
00067 
00068         self._grn_node1_1_1 = '/node1/node1_1/node1_1_1'
00069         self._len_lower_grn_node1_1 = 2
00070 
00071     def tearDown(self):
00072         unittest.TestCase.tearDown(self)
00073         del self._model
00074 
00075     def test_get_upper_grn(self):
00076         self.assertEqual(RqtRosGraph.get_upper_grn(self._node1_1_1.index(), ''),
00077                          self._grn_node1_1_1)
00078 
00079     def test_get_lower_grn_dfs(self):
00080         self.assertEqual(len(RqtRosGraph.get_lower_grn_dfs(
00081                                                   self._node1_1.index(),
00082                                                   '')),
00083                          self._len_lower_grn_node1_1)
00084 
00085     def test_get_full_grn(self):
00086         self.assertEqual(RqtRosGraph.get_full_grn(self._node1_1_1.index()),
00087                          self._grn_node1_1_1)
00088 
00089 
00090 if __name__ == '__main__':
00091     unittest.main()


rqt_py_common
Author(s): Dorian Scholz, Isaac Saito
autogenerated on Wed Sep 16 2015 06:58:00