Always use predefined map in game unit tests
This commit is contained in:
		@@ -54,6 +54,8 @@ class Map:
 | 
			
		||||
        self.height = height
 | 
			
		||||
        self.start_y = start_y
 | 
			
		||||
        self.start_x = start_x
 | 
			
		||||
        self.currenty = start_y
 | 
			
		||||
        self.currentx = start_x
 | 
			
		||||
        self.tiles = tiles
 | 
			
		||||
        self.entities = []
 | 
			
		||||
        self.logs = Logs()
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ from ..entities.items import Bomb, Heart, Sword
 | 
			
		||||
from ..entities.player import Player
 | 
			
		||||
from ..enums import DisplayActions
 | 
			
		||||
from ..game import Game, KeyValues, GameMode
 | 
			
		||||
from ..interfaces import Tile
 | 
			
		||||
from ..interfaces import Tile, Map
 | 
			
		||||
from ..menus import MainMenuValues
 | 
			
		||||
from ..resources import ResourceManager
 | 
			
		||||
from ..settings import Settings
 | 
			
		||||
@@ -26,6 +26,10 @@ class TestGame(unittest.TestCase):
 | 
			
		||||
        """
 | 
			
		||||
        self.game = Game()
 | 
			
		||||
        self.game.new_game()
 | 
			
		||||
        self.game.map = Map.load(ResourceManager.get_asset_path(
 | 
			
		||||
            "example_map.txt"))
 | 
			
		||||
        self.game.player.move(self.game.map.start_y, self.game.map.start_x)
 | 
			
		||||
        self.game.map.add_entity(self.game.player)
 | 
			
		||||
        self.game.logs.add_message("Hello World !")
 | 
			
		||||
        display = DisplayManager(None, self.game)
 | 
			
		||||
        self.game.display_actions = display.handle_display_action
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user