2 PKG =
'ez_interactive_marker' 3 import roslib; roslib.load_manifest(PKG)
12 rospy.init_node(
"test")
15 controller = ec.GroupedCheckStateController(server, menu_handler)
16 e0 = menu_handler.insert(
"menu0")
17 controller.add_group(
"group0", e0)
18 e1 = menu_handler.insert(
"menu1")
19 controller.add_group(
"group0", e1)
20 e2 = menu_handler.insert(
"menu2")
21 controller.add_group(
"group0", e2)
22 e3 = menu_handler.insert(
"menu3")
23 controller.add_group(
"group1", e3)
24 e4 = menu_handler.insert(
"menu4")
25 controller.add_group(
"group1", e4)
26 controller.update_check_state(e0)
27 self.assertEqual(menu_handler.getCheckState(e0), MenuHandler.CHECKED)
28 self.assertEqual(menu_handler.getCheckState(e1), MenuHandler.UNCHECKED)
29 self.assertEqual(menu_handler.getCheckState(e2), MenuHandler.UNCHECKED)
30 self.assertEqual(menu_handler.getCheckState(e3), MenuHandler.UNCHECKED)
31 self.assertEqual(menu_handler.getCheckState(e4), MenuHandler.UNCHECKED)
33 controller.update_check_state(e2)
34 self.assertEqual(menu_handler.getCheckState(e0), MenuHandler.UNCHECKED)
35 self.assertEqual(menu_handler.getCheckState(e1), MenuHandler.UNCHECKED)
36 self.assertEqual(menu_handler.getCheckState(e2), MenuHandler.CHECKED)
37 self.assertEqual(menu_handler.getCheckState(e3), MenuHandler.UNCHECKED)
38 self.assertEqual(menu_handler.getCheckState(e4), MenuHandler.UNCHECKED)
40 controller.update_check_state(e4)
41 self.assertEqual(menu_handler.getCheckState(e0), MenuHandler.UNCHECKED)
42 self.assertEqual(menu_handler.getCheckState(e1), MenuHandler.UNCHECKED)
43 self.assertEqual(menu_handler.getCheckState(e2), MenuHandler.CHECKED)
44 self.assertEqual(menu_handler.getCheckState(e3), MenuHandler.UNCHECKED)
45 self.assertEqual(menu_handler.getCheckState(e4), MenuHandler.CHECKED)
47 if __name__ ==
'__main__':
49 rostest.rosrun(PKG,
'test_controller', TestController)
def test_grouped_check_state(self)