Always use predefined map in game unit tests

This commit is contained in:
Yohann D'ANELLO 2020-12-11 19:27:57 +01:00
parent 209bde5b5c
commit fb926f8c84
2 changed files with 7 additions and 1 deletions

View File

@ -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()

View File

@ -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