def test_reset(self): window = gen_touch_window(True, 'not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) scene = gen_scene([window]) scene_msg = gen_scene_msg(scene) self.scene_pub.publish(scene_msg) rospy.sleep(GRACE_DELAY) self.assertEqual(1, len(self.receiver.msgs)) msg = self.receiver.msgs[-1] self.assertEqual(1, len(msg.strings)) self.assertTrue('not_the_default' in msg.strings) window = gen_touch_window(False, 'also_not_the_default', target=TEST_DEFAULT_VIEWPORT, activity='not_mirror') scene = gen_scene([window]) scene_msg = gen_scene_msg(scene) self.scene_pub.publish(scene_msg) rospy.sleep(GRACE_DELAY) self.assertEqual(2, len(self.receiver.msgs)) msg = self.receiver.msgs[-1] self.assertEqual(EXPECTED_DEFAULT_MSG, msg.strings)
def test_5_route_touch_on_two_viewports(self): """ Generate message that will contain two browsers without with route touch set to `true` on one of them The cthulhu_fhtagn viepwort should be emitted """ window1 = gen_touch_window(route=True, source='cthulhu_fhtagn', target='123rtghj', activity='mirror') window2 = gen_touch_window(route=True, source='iah_iah', target='123rtghj', activity='mirror') scene = gen_scene([window1, window2]) scene_msg = gen_scene_msg(scene) self.director_publisher.publish(scene_msg) time.sleep(1) # need to ensure visibility last value flip self.visibility_publisher.publish(Bool(data=False)) self.visibility_publisher.publish(Bool(data=True)) time.sleep(1) self.active_wait('True', VISIBILITY.value) self.active_wait("['cthulhu_fhtagn', 'iah_iah']", ACTIVATE.value)
def test_5_route_touch_on_two_viewports(self): """ Generate message that will contain two browsers without with route touch set to `true` on one of them The cthulhu_fhtagn viepwort should be emitted """ window1 = gen_touch_window( route=True, source='cthulhu_fhtagn', target='123rtghj', activity='mirror') window2 = gen_touch_window( route=True, source='iah_iah', target='123rtghj', activity='mirror') scene = gen_scene([window1, window2]) scene_msg = gen_scene_msg(scene) self.director_publisher.publish(scene_msg) time.sleep(1) # need to ensure visibility last value flip self.visibility_publisher.publish(Bool(data=False)) self.visibility_publisher.publish(Bool(data=True)) time.sleep(1) self.active_wait('True', VISIBILITY.value) self.active_wait("['cthulhu_fhtagn', 'iah_iah']", ACTIVATE.value)
def test_no_route(self): window = gen_touch_window(False, 'not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) scene = gen_scene([window]) scene_msg = gen_scene_msg(scene) self.scene_pub.publish(scene_msg) rospy.sleep(GRACE_DELAY) self.assertEqual(1, len(self.receiver.msgs)) msg = self.receiver.msgs[-1] self.assertEqual(EXPECTED_DEFAULT_MSG, msg.strings)
def test_one_route(self): window0 = gen_touch_window(True, 'not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) window1 = gen_touch_window(False, 'also_not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) scene = gen_scene([window0, window1]) scene_msg = gen_scene_msg(scene) self.scene_pub.publish(scene_msg) rospy.sleep(GRACE_DELAY) self.assertEqual(1, len(self.receiver.msgs)) msg = self.receiver.msgs[-1] self.assertEqual(1, len(msg.strings)) self.assertTrue('not_the_default' in msg.strings)
def test_one_route(self): window0 = gen_touch_window(True, 'not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) window1 = gen_touch_window(False, 'also_not_the_default', target=TEST_DEFAULT_VIEWPORT, activity=MIRROR_ACTIVITY_TYPE) scene = gen_scene([window0, window1]) scene_msg = gen_scene_msg(scene) self.scene_pub.publish(scene_msg) rospy.sleep(GRACE_DELAY) self.assertEqual(1, len(self.receiver.msgs)) msg = self.receiver.msgs[-1] self.assertEqual(1, len(msg.strings)) self.assertTrue('not_the_default' in msg.strings)
def test_2_default_viewport_no_route_touch(self): """ Generate message that will contain a browser without route touch set to `true`. Default viewport should be emitted after visibility message on the activate topic """ window = gen_browser_window(route=False, target='cthulhu_fhtagn') scene = gen_scene([window]) scene_msg = gen_scene_msg(scene) self.director_publisher.publish(scene_msg) time.sleep(1) # need to ensure visibility last value flip self.visibility_publisher.publish(Bool(data=False)) self.visibility_publisher.publish(Bool(data=True)) time.sleep(1) self.active_wait('True', VISIBILITY.value) self.active_wait("['kiosk']", ACTIVATE.value)
def test_2_default_viewport_no_route_touch(self): """ Generate message that will contain a browser without route touch set to `true`. Default viewport should be emitted after visibility message on the activate topic """ window = gen_browser_window(route=False, target='cthulhu_fhtagn') scene = gen_scene([window]) scene_msg = gen_scene_msg(scene) self.director_publisher.publish(scene_msg) time.sleep(1) # need to ensure visibility last value flip self.visibility_publisher.publish(Bool(data=False)) self.visibility_publisher.publish(Bool(data=True)) time.sleep(1) self.active_wait('True', VISIBILITY.value) self.active_wait("['kiosk']", ACTIVATE.value)