def test_world_draw(benchmark): """Compare current screen with past screenshot""" g = Game() Game.set_sidebar(False) s = SerializerMock() w = World(s, block_seed=0) block = w.get(Game.idx_cur, Game.idy_cur) player = block.set_entity(Player, Game.map_size//2, Game.map_size//2) # Potentially update player location block.reposition_entity(player, avoid_hidden=True) # Update view to player location player.update_view_location() benchmark(w.draw)
def setUp(self): """Set up game/player to allow drawing""" self.__class__.set_game() Game.set_sidebar(False) s = SerializerMock() w = World(s, block_seed=0) start_block = w.get(Game.idx_cur, Game.idy_cur) player = start_block.set_entity(Player, Game.map_size//2, Game.map_size//2) # Potentially update player location start_block.reposition_entity(player, avoid_hidden=True) # Update view to player location player.update_view_location() status_bar_mock = StatusBarMock() self.status_bar_mock = status_bar_mock self.player = player self.w = w self.start_block = start_block self.console_flush = console_flush