def test_show_hide_rendering(self, _init_pygame, _display_surface_return_none): resolution = (500, 500) empty_surface = pygame.Surface(resolution) empty_surface.fill(pygame.Color(0, 0, 0)) surface = empty_surface.copy() manager = pygame_gui.UIManager(resolution) confirm_dialog = UIConfirmationDialog(rect=pygame.Rect(100, 100, 400, 300), manager=manager, action_long_desc="Confirm a test of the " "confirmation dialog.", window_title="Confirm", action_short_name="Confirm", visible=0) manager.update(0.01) manager.draw_ui(surface) assert compare_surfaces(empty_surface, surface) surface.fill(pygame.Color(0, 0, 0)) confirm_dialog.show() manager.update(0.01) manager.draw_ui(surface) assert not compare_surfaces(empty_surface, surface) surface.fill(pygame.Color(0, 0, 0)) confirm_dialog.hide() manager.update(0.01) manager.draw_ui(surface) assert compare_surfaces(empty_surface, surface)
def test_hide(self, _init_pygame, default_ui_manager, _display_surface_return_none): confirm_dialog = UIConfirmationDialog(rect=pygame.Rect(100, 100, 400, 300), manager=default_ui_manager, action_long_desc="Confirm a test of the " "confirmation dialog.", window_title="Confirm", action_short_name="Confirm", visible=1) assert confirm_dialog.visible == 1 assert confirm_dialog.confirm_button.visible == 1 assert confirm_dialog.cancel_button.visible == 1 confirm_dialog.hide() assert confirm_dialog.visible == 0 assert confirm_dialog.confirm_button.visible == 0 assert confirm_dialog.cancel_button.visible == 0