diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index 28d20de..93af352 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -74,6 +74,7 @@ class Game: """ if self.message: self.message = None + self.display_actions(DisplayActions.REFRESH) return if self.state == GameMode.PLAY: diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index 28b354d..a466fa9 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -4,6 +4,8 @@ import os import unittest +from squirrelbattle.enums import DisplayActions + from squirrelbattle.bootstrap import Bootstrap from squirrelbattle.display.display import Display from squirrelbattle.display.display_manager import DisplayManager @@ -292,3 +294,13 @@ class TestGame(unittest.TestCase): Check that some functions are not implemented, only for coverage. """ self.assertRaises(NotImplementedError, Display.display, None) + + def test_messages(self) -> None: + """ + Display error messages. + """ + self.game.message = "I am an error" + self.game.display_actions(DisplayActions.UPDATE) + self.game.display_actions(DisplayActions.REFRESH) + self.game.handle_key_pressed(None, "random key") + self.assertIsNone(self.game.message)