diff --git a/dungeonbattle/display/menudisplay.py b/dungeonbattle/display/menudisplay.py index 257b271..aeed447 100644 --- a/dungeonbattle/display/menudisplay.py +++ b/dungeonbattle/display/menudisplay.py @@ -27,10 +27,9 @@ class MenuDisplay(Display): self.pad.addstr(self.menu.position, 0, ">") def display(self) -> None: - if self.height - 2 >= self.menu.position - 1: - cornery = 0 - elif self.height - 2 >= self.trueheight - self.menu.position: - cornery = self.trueheight - self.height + 2 + cornery = 0 if self.height - 2 >= self.menu.position - 1 \ + else self.trueheight - self.height + 2 \ + if self.height - 2 >= self.trueheight - self.menu.position else 0 # Menu box self.menubox.addstr(0, 0, "┏" + "━" * (self.width - 2) + "┓") diff --git a/dungeonbattle/tests/game_test.py b/dungeonbattle/tests/game_test.py index c933847..2498b48 100644 --- a/dungeonbattle/tests/game_test.py +++ b/dungeonbattle/tests/game_test.py @@ -1,8 +1,9 @@ +import os import unittest +from dungeonbattle.bootstrap import Bootstrap from dungeonbattle.display.display import Display from dungeonbattle.display.display_manager import DisplayManager -from dungeonbattle.display.statsdisplay import StatsDisplay from dungeonbattle.game import Game, KeyValues, GameMode from dungeonbattle.menus import MainMenuValues @@ -21,6 +22,15 @@ class TestGame(unittest.TestCase): self.assertRaises(NotImplementedError, Game.load_game, "game.save") self.assertRaises(NotImplementedError, Display(None).display) + def test_bootstrap_fail(self) -> None: + """ + Ensure that the test can't play the game, + because there is no associated shell. + Yeah, that's only for coverage. + """ + self.assertRaises(Exception, Bootstrap.run_game) + self.assertEqual(os.getenv("TERM", "unknown"), "unknown") + def test_key_translation(self) -> None: """ Test key bindings. @@ -106,9 +116,3 @@ class TestGame(unittest.TestCase): self.game.handle_key_pressed(KeyValues.SPACE) self.assertEqual(self.game.state, GameMode.MAINMENU) - - def test_stats_display(self) -> None: - self.game.current_display = StatsDisplay(None) - self.game.current_display.update_player(self.game.player) - self.game.current_display.resize(0, 0, 42, 42) - self.game.current_display.refresh()