diff --git a/dungeonbattle/tests/game_test.py b/dungeonbattle/tests/game_test.py index c83e851..84d7cf9 100644 --- a/dungeonbattle/tests/game_test.py +++ b/dungeonbattle/tests/game_test.py @@ -122,3 +122,20 @@ class TestGame(unittest.TestCase): self.game.handle_key_pressed(KeyValues.SPACE) self.assertEqual(self.game.state, GameMode.MAINMENU) + + def test_dead_screen(self): + """ + Kill player and render dead screen. + """ + self.game.state = GameMode.PLAY + # Kill player + self.game.player.take_damage(self.game.player, + self.game.player.health + 2) + y, x = self.game.player.y, self.game.player.x + for key in [KeyValues.UP, KeyValues.DOWN, + KeyValues.LEFT, KeyValues.RIGHT]: + self.game.handle_key_pressed(key) + new_y, new_x = self.game.player.y, self.game.player.x + self.assertEqual(new_y, y) + self.assertEqual(new_x, x) +