comparison gamelib/tests/test_walkthrough.py @ 254:ca0c2875ad8f

More test fixes.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 27 Aug 2010 17:35:15 +0200
parents dfc89bc64fdb
children bfb6c682b4fb
comparison
equal deleted inserted replaced
253:60a0757bee05 254:ca0c2875ad8f
6 CURRENT_SCENE = 'cryo' 6 CURRENT_SCENE = 'cryo'
7 7
8 def close_detail(self): 8 def close_detail(self):
9 self.state.set_current_detail(None) 9 self.state.set_current_detail(None)
10 10
11 def move(self, source, target): 11 def move_to(self, target):
12 self.interact_thing(source+'.door') 12 self.interact_thing(self.state.current_scene.name + '.door')
13 self.assert_current_scene('map') 13 self.assert_current_scene('map')
14 self.interact_thing('map.to'+target) 14 self.interact_thing('map.to' + target)
15 self.assert_current_scene(target) 15 self.assert_current_scene(target)
16
17 def test_walkthrough_complete(self):
18 self.fail("Walkthrough incomplete.")
16 19
17 def test_walkthrough(self): 20 def test_walkthrough(self):
18 """A complete game walkthrough. 21 """A complete game walkthrough.
19 22
20 This should only contain interacts and assertions.""" 23 This should only contain interacts and assertions."""
38 # Open the door the rest of the way. 41 # Open the door the rest of the way.
39 self.interact_thing('cryo.door', 'titanium_leg') 42 self.interact_thing('cryo.door', 'titanium_leg')
40 self.assert_game_data('door', 'open', 'cryo.door') 43 self.assert_game_data('door', 'open', 'cryo.door')
41 self.assert_inventory_item('titanium_leg') 44 self.assert_inventory_item('titanium_leg')
42 45
43 # Go to the machine room.
44 self.move('cryo', 'machine')
45
46 # Sharpen leg into machete.
47 self.interact_thing('machine.grinder', 'titanium_leg')
48 self.assert_inventory_item('titanium_leg', False)
49 self.assert_inventory_item('machete')
50
51 # Go to the mess. 46 # Go to the mess.
52 self.move('machine', 'mess') 47 self.move_to('mess')
53
54 # Clear the broccoli.
55 self.assert_game_data('status', 'blocked', 'mess.tubes')
56 self.interact_thing('mess.tubes', 'machete')
57 self.assert_game_data('status', 'broken', 'mess.tubes')
58 48
59 # Get the cans. 49 # Get the cans.
60 self.assert_game_data('cans_available', 3, 'mess.cans') 50 self.assert_game_data('cans_available', 3, 'mess.cans')
61 self.interact_thing('mess.cans') 51 self.interact_thing('mess.cans')
62 self.assert_inventory_item('full_can.0') 52 self.assert_inventory_item('full_can.0')
64 self.assert_inventory_item('full_can.1') 54 self.assert_inventory_item('full_can.1')
65 self.interact_thing('mess.cans') 55 self.interact_thing('mess.cans')
66 self.assert_inventory_item('full_can.2') 56 self.assert_inventory_item('full_can.2')
67 self.assert_game_data('cans_available', 0, 'mess.cans') 57 self.assert_game_data('cans_available', 0, 'mess.cans')
68 58
59 # Bash one of the cans.
60 self.assert_item_exists('dented_can.0', False)
61 self.interact_item('full_can.1', 'titanium_leg')
62 self.assert_inventory_item('dented_can.0')
63 self.assert_inventory_item('full_can.1', False)
69 64
70 self.fail("Walkthrough incomplete.") 65 # Go to the machine room.
66 self.move_to('machine')
71 67
68 # Sharpen leg into machete.
69 self.interact_thing('machine.grinder', 'titanium_leg')
70 self.assert_inventory_item('titanium_leg', False)
71 self.assert_inventory_item('machete')
72
73 # Go to the cryo room.
74 self.move_to('cryo')
75
76 # Chop up some pipes.
77 self.assert_game_data('fixed', True, 'cryo.pipe.left')
78 self.interact_thing('cryo.pipe.left', 'machete')
79 self.assert_game_data('fixed', False, 'cryo.pipe.left')
80 self.assert_inventory_item('cryo_pipe.0')
81
82 self.assert_game_data('fixed', True, 'cryo.pipe.right')
83 self.interact_thing('cryo.pipe.right', 'machete')
84 self.assert_game_data('fixed', False, 'cryo.pipe.right')
85 self.assert_inventory_item('cryo_pipe.1')
86
87 # Go to the mess.
88 self.move_to('mess')
89
90 # Clear the broccoli.
91 self.assert_game_data('status', 'blocked', 'mess.tubes')
92 self.interact_thing('mess.tubes', 'machete')
93 self.assert_game_data('status', 'broken', 'mess.tubes')
94