def test_set_active_state(self, _init_pygame, default_ui_manager: UIManager): shape = DrawableShape(containing_rect=pygame.Rect(0, 0, 100, 100), theming_parameters={}, states=['normal', 'hovered'], manager=default_ui_manager) shape.set_active_state('hovered') assert shape.active_state.state_id == 'hovered'
def test_set_active_state_with_transitions(self, _init_pygame, default_ui_manager: UIManager): shape = DrawableShape(containing_rect=pygame.Rect(0, 0, 100, 100), theming_parameters={'transitions': {('normal', 'hovered'): 0.5, ('hovered', 'normal'): 0.5}}, states=['normal', 'hovered'], manager=default_ui_manager) shape.set_active_state('hovered') shape.update(0.05) shape.set_active_state('normal') assert shape.active_state.transition is not None