def test_drawer_blit_simple(pygame): drawer = Drawer(Game()) image = object() drawer.IMAGES = {'IMAGE': image} drawer._blit('IMAGE', NPC(1, 2)) drawer.screen.blit.assert_called_once_with( image, (drawer.OFFSET + 1, drawer.OFFSET + 2))
def test_drawer_blit_pack(pygame): drawer = Drawer(Game()) image = object() drawer.IMAGES = {'IMAGE': {Direction.DOWN: image}} monster = NPC(1, 2) monster.set_direction(Direction.DOWN) drawer._blit('IMAGE', monster) drawer.screen.blit.assert_called_once_with( image, (drawer.OFFSET + 1, drawer.OFFSET + 2))
def test_render_players_with_freeze(pygame): game = Game() game.alive_players = [ Player(0, 32, 32), ] game.alive_players[0].set_freeze() drawer = Drawer(game) drawer._blit = Mock(spec=drawer._blit) drawer._render_players() assert drawer._blit.call_args_list == [ call('IMG_PLAYER_1_1', game.alive_players[0]), call('FREEZE', game.alive_players[0]), ]
def test_render_players(pygame): game = Game() game.alive_players = [ Player(0, 32, 32), Player(1, 64, 32), ] drawer = Drawer(game) drawer._blit = Mock(spec=drawer._blit) drawer._render_players() assert drawer._blit.call_args_list == [ call('IMG_PLAYER_1_1', game.alive_players[0]), call('IMG_PLAYER_2_1', game.alive_players[1]), ]
def test_render_bullets(pygame): game = Game() game.bullets = [ Bullet(32, 32), Bullet(64, 32), ] drawer = Drawer(game) drawer._blit = Mock(spec=drawer._blit) drawer._render_bullets() assert drawer._blit.call_args_list == [ call('BULLET', game.bullets[0]), call('BULLET', game.bullets[1]), ]
def test_render_npcs(pygame): game = Game() game.npcs = [ NPC(32, 32), NPC(64, 32), ] drawer = Drawer(game) drawer._blit = Mock(spec=drawer._blit) drawer._render_npcs() assert drawer._blit.call_args_list == [ call('IMG_NPC_1', game.npcs[0]), call('IMG_NPC_1', game.npcs[1]), ]