Test message display
This commit is contained in:
parent
25ba94b9ac
commit
5faebfe556
@ -74,6 +74,7 @@ class Game:
|
||||
"""
|
||||
if self.message:
|
||||
self.message = None
|
||||
self.display_actions(DisplayActions.REFRESH)
|
||||
return
|
||||
|
||||
if self.state == GameMode.PLAY:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user