def test___init__(self, mocker): """Test object initialization.""" mock_super_init = mocker.patch.object( ht.events.rop_render.HoudiniEventGroup, "__init__") event_map = {} mocker.patch.object(ht.events.events.rop_render.RopRenderEvent, "event_map", event_map) event = ht.events.events.rop_render.RopRenderEvent() mock_super_init.assert_called() assert event._frame_start is None assert event._render_start is None expected_map = { RopEvents.PreRender: HoudiniEventItem((event.pre_render, )), RopEvents.PreFrame: HoudiniEventItem((event.pre_frame, )), RopEvents.PostFrame: HoudiniEventItem((event.post_frame, )), RopEvents.PostRender: HoudiniEventItem((event.post_render, )), RopEvents.PostWrite: HoudiniEventItem((event.post_write, )), } assert event_map == expected_map
def __init__(self): super(StyleNodeEvent, self).__init__() self.event_map.update({ NodeEvents.OnCreated: HoudiniEventItem((self.style_node_on_creation, )), NodeEvents.OnNameChanged: HoudiniEventItem((self.style_node_by_name, )), })
def test___init__(self): """Test object initialization.""" event = ht.nodes.styles.event.StyleNodeEvent() expected_map = { NodeEvents.OnCreated: HoudiniEventItem((event.style_node_on_creation,)), NodeEvents.OnNameChanged: HoudiniEventItem((event.style_node_by_name,)), } assert event.event_map == expected_map
def test___init__(self): event = ht.nodes.styles.event.StyleNodeEvent() expected_map = { NodeEvents.OnCreated: HoudiniEventItem((event.style_node_on_creation, )), NodeEvents.OnNameChanged: HoudiniEventItem((event.style_node_by_name, )), } self.assertEqual(event.event_map, expected_map)
def __init__(self): super(RopRenderEvent, self).__init__() self._frame_start = None self._render_start = None self.event_map.update( { RopEvents.PreRender: HoudiniEventItem((self.pre_render,)), RopEvents.PreFrame: HoudiniEventItem((self.pre_frame,)), RopEvents.PostFrame: HoudiniEventItem((self.post_frame,)), RopEvents.PostRender: HoudiniEventItem((self.post_render,)), RopEvents.PostWrite: HoudiniEventItem((self.post_write,)), } )
def test___init__(self): event = ht.events.events.rop_render.RopRenderEvent() self.assertIsNone(event._frame_start) self.assertIsNone(event._render_start) expected_map = { RopEvents.PreRender: HoudiniEventItem((event.pre_render,)), RopEvents.PreFrame: HoudiniEventItem((event.pre_frame,)), RopEvents.PostFrame: HoudiniEventItem((event.post_frame,)), RopEvents.PostRender: HoudiniEventItem((event.post_render,)), RopEvents.PostWrite: HoudiniEventItem((event.post_write,)), } self.assertEqual(event.event_map, expected_map)
def register_function(func, event_name, item_name=None, priority=1, stat_tags=None): """Register a function for a given event name. :param: func: The function to register. :type func: collections.Callable :param: event_name: The event name. :type event_name: str :param item_name: Optional item name. :type item_name: str :param: priority: The event priority. :type priority: int :param: stat_tags: Optional tags to group stats together. :type stat_tags: [str] :return: """ if not isinstance(func, collections.Callable): raise TypeError("{} is not callable".format(func)) item = HoudiniEventItem((func, ), item_name, priority, stat_tags=stat_tags) register_item(item, event_name)
def test___init__(self): """Test object initialization.""" event = ht.events.events.rop_render.RopRenderEvent() assert event._frame_start is None assert event._render_start is None expected_map = { RopEvents.PreRender: HoudiniEventItem((event.pre_render, )), RopEvents.PreFrame: HoudiniEventItem((event.pre_frame, )), RopEvents.PostFrame: HoudiniEventItem((event.post_frame, )), RopEvents.PostRender: HoudiniEventItem((event.post_render, )), RopEvents.PostWrite: HoudiniEventItem((event.post_write, )), } assert event.event_map == expected_map
def test___init__(self): event = ht.events.events.scene_load.SceneLoadEvent() expected_map = { SceneEvents.Load: HoudiniEventItem( (event.clear_session_settings, )), } assert event.event_map == expected_map
def test___init__(self, mocker): """Test object initialization.""" mock_super_init = mocker.patch.object( ht.events.scene_load.HoudiniEventGroup, "__init__") event_map = {} mocker.patch.object(ht.events.events.scene_load.SceneLoadEvent, "event_map", event_map) event = ht.events.events.scene_load.SceneLoadEvent() mock_super_init.asset_called() expected_map = { SceneEvents.Load: HoudiniEventItem( (event.clear_session_settings, )) } assert event_map == expected_map
def __init__(self): super(SceneLoadEvent, self).__init__() load_item = HoudiniEventItem((self.clear_session_settings, )) self.event_map.update({SceneEvents.Load: load_item})