Slightly cover bootstrap, to increase more and more coverage. Ensure that there is no associated shell
This commit is contained in:
		@@ -27,10 +27,9 @@ class MenuDisplay(Display):
 | 
				
			|||||||
        self.pad.addstr(self.menu.position, 0, ">")
 | 
					        self.pad.addstr(self.menu.position, 0, ">")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def display(self) -> None:
 | 
					    def display(self) -> None:
 | 
				
			||||||
        if self.height - 2 >= self.menu.position - 1:
 | 
					        cornery = 0 if self.height - 2 >= self.menu.position - 1 \
 | 
				
			||||||
            cornery = 0
 | 
					            else self.trueheight - self.height + 2 \
 | 
				
			||||||
        elif self.height - 2 >= self.trueheight - self.menu.position:
 | 
					            if self.height - 2 >= self.trueheight - self.menu.position else 0
 | 
				
			||||||
            cornery = self.trueheight - self.height + 2
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Menu box
 | 
					        # Menu box
 | 
				
			||||||
        self.menubox.addstr(0, 0, "┏" + "━" * (self.width - 2) + "┓")
 | 
					        self.menubox.addstr(0, 0, "┏" + "━" * (self.width - 2) + "┓")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
 | 
					import os
 | 
				
			||||||
import unittest
 | 
					import unittest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from dungeonbattle.bootstrap import Bootstrap
 | 
				
			||||||
from dungeonbattle.display.display import Display
 | 
					from dungeonbattle.display.display import Display
 | 
				
			||||||
from dungeonbattle.display.display_manager import DisplayManager
 | 
					from dungeonbattle.display.display_manager import DisplayManager
 | 
				
			||||||
from dungeonbattle.display.statsdisplay import StatsDisplay
 | 
					 | 
				
			||||||
from dungeonbattle.game import Game, KeyValues, GameMode
 | 
					from dungeonbattle.game import Game, KeyValues, GameMode
 | 
				
			||||||
from dungeonbattle.menus import MainMenuValues
 | 
					from dungeonbattle.menus import MainMenuValues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,6 +22,15 @@ class TestGame(unittest.TestCase):
 | 
				
			|||||||
        self.assertRaises(NotImplementedError, Game.load_game, "game.save")
 | 
					        self.assertRaises(NotImplementedError, Game.load_game, "game.save")
 | 
				
			||||||
        self.assertRaises(NotImplementedError, Display(None).display)
 | 
					        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:
 | 
					    def test_key_translation(self) -> None:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Test key bindings.
 | 
					        Test key bindings.
 | 
				
			||||||
@@ -106,9 +116,3 @@ class TestGame(unittest.TestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.game.handle_key_pressed(KeyValues.SPACE)
 | 
					        self.game.handle_key_pressed(KeyValues.SPACE)
 | 
				
			||||||
        self.assertEqual(self.game.state, GameMode.MAINMENU)
 | 
					        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()
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user