From e88b4ee775fc002e7771d0c6fbc3f4ca8e314441 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 11 Nov 2020 17:17:28 +0100 Subject: [PATCH] Render game when we are dead --- dungeonbattle/tests/game_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) +