comparison pyntnclick/tests/game_logic_utils.py @ 743:432cd9d51d80 pyntnclick

Import the 'mad clicker' test stuff
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 16 Jan 2013 13:57:00 +0200
parents c1d548a76a8c
children ef4bda7d623d
comparison
equal deleted inserted replaced
742:0d5ff96527da 743:432cd9d51d80
1 import unittest 1 import unittest
2 2
3 import pygame.display 3 import pygame.display
4 import pygame.event
4 5
5 import pyntnclick.resources 6 import pyntnclick.resources
6 import pyntnclick.state 7 import pyntnclick.state
7 8
8 9
27 28
28 def tearDown(self): 29 def tearDown(self):
29 for item in self.state.items.values(): 30 for item in self.state.items.values():
30 if isinstance(item, pyntnclick.state.CloneableItem): 31 if isinstance(item, pyntnclick.state.CloneableItem):
31 type(item)._counter = 0 32 type(item)._counter = 0
33
34 def clear_event_queue(self):
35 # Since we aren't handling events, we may overflow the pygame
36 # event buffer if we're generating a lot of events
37 pygame.event.clear()
38
39 def clear_inventory(self):
40 # Remove all items from the inventory, ensuring tool is set to None
41 self.state.set_tool(None)
42 self.state.inventory = []
32 43
33 def set_game_data(self, key, value, thing=None): 44 def set_game_data(self, key, value, thing=None):
34 gizmo = self.state.current_scene 45 gizmo = self.state.current_scene
35 if thing is not None: 46 if thing is not None:
36 gizmo = gizmo.things[thing] 47 gizmo = gizmo.things[thing]