comparison gamelib/tests/game_logic_utils.py @ 527:6ef7cc57b94b

Monkey-patch albow.resource.get_image() in tests to avoid having to set up pygame display stuff.
author Jeremy Thurgood <firxen@gmail.com>
date Thu, 09 Sep 2010 11:11:37 +0200
parents 9f488671c02e
children 0ce08d5e2acb
comparison
equal deleted inserted replaced
526:a984cf27b527 527:6ef7cc57b94b
5 5
6 from gamelib import state 6 from gamelib import state
7 from gamelib.constants import SCREEN 7 from gamelib.constants import SCREEN
8 8
9 9
10 # We need this stuff set up so we can load images and whatnot. 10 # Monkey-patch albow.resource.get_image to not do alpha-conversion,
11 pygame.display.init() 11 # which would require pygame display intialisation, which we don't
12 pygame.font.init() 12 # really want in the tests.
13 pygame.display.set_mode(SCREEN, SWSURFACE) 13 import albow.resource
14
15 def get_image_unoptimized(*names, **kw):
16 kw.setdefault('optimize', False)
17 return albow.resource._get_image(names, **kw)
18
19 albow.resource.get_image = get_image_unoptimized
14 20
15 21
16 class GameLogicTestCase(unittest.TestCase): 22 class GameLogicTestCase(unittest.TestCase):
17 CURRENT_SCENE = None 23 CURRENT_SCENE = None
18 24