comparison gamelib/tests/test_scene_interactions_cryo.py @ 190:30f2308c1efc

Fix tests and add a (currently unhooked) laser welder.
author Jeremy Thurgood <firxen@gmail.com>
date Wed, 25 Aug 2010 20:09:19 +0200
parents e97244b1be30
children 0bad554d0926
comparison
equal deleted inserted replaced
189:c18ef647ffe6 190:30f2308c1efc
6 CURRENT_SCENE = 'cryo' 6 CURRENT_SCENE = 'cryo'
7 7
8 def test_cryo_door_closed_hand(self): 8 def test_cryo_door_closed_hand(self):
9 "The door is closed and we touch it with the hand. It becomes ajar." 9 "The door is closed and we touch it with the hand. It becomes ajar."
10 10
11 self.assert_game_data('accessible', True)
12 self.assert_game_data('accessible', False, scene='bridge')
13 self.assert_game_data('door', 'shut', 'cryo.door') 11 self.assert_game_data('door', 'shut', 'cryo.door')
14 12
15 self.interact_thing('cryo.door') 13 self.interact_thing('cryo.door')
16 14
17 self.assert_game_data('accessible', True)
18 self.assert_game_data('accessible', False, scene='bridge')
19 self.assert_game_data('door', 'ajar', 'cryo.door') 15 self.assert_game_data('door', 'ajar', 'cryo.door')
20 16
21 def test_cryo_door_closed_titanium_leg(self): 17 def test_cryo_door_closed_titanium_leg(self):
22 "The door is closed and we touch it with the titanium leg. It opens." 18 "The door is closed and we touch it with the titanium leg. It opens."
23 19
24 self.state.add_inventory_item('titanium_leg') 20 self.state.add_inventory_item('titanium_leg')
25 self.assert_game_data('accessible', True)
26 self.assert_game_data('accessible', False, scene='bridge')
27 self.assert_game_data('door', 'shut', 'cryo.door') 21 self.assert_game_data('door', 'shut', 'cryo.door')
28 22
29 self.interact_thing('cryo.door', 'titanium_leg') 23 self.interact_thing('cryo.door', 'titanium_leg')
30 24
31 self.assert_game_data('accessible', True)
32 self.assert_game_data('accessible', False, scene='bridge')
33 self.assert_game_data('door', 'shut', 'cryo.door') 25 self.assert_game_data('door', 'shut', 'cryo.door')
34 self.assert_inventory_item('titanium_leg', True) 26 self.assert_inventory_item('titanium_leg', True)
35 27
36 def test_cryo_door_ajar_hand(self): 28 def test_cryo_door_ajar_hand(self):
37 "The door is ajar and we touch it with the hand. No change." 29 "The door is ajar and we touch it with the hand. No change."
38 30
39 self.set_game_data('door', 'ajar', 'cryo.door') 31 self.set_game_data('door', 'ajar', 'cryo.door')
40 self.assert_game_data('accessible', True)
41 self.assert_game_data('accessible', False, scene='bridge')
42 32
43 self.interact_thing('cryo.door') 33 self.interact_thing('cryo.door')
44 34
45 self.assert_game_data('accessible', True)
46 self.assert_game_data('accessible', False, scene='bridge')
47 self.assert_game_data('door', 'ajar', 'cryo.door') 35 self.assert_game_data('door', 'ajar', 'cryo.door')
48 36
49 def test_cryo_door_ajar_titanium_leg(self): 37 def test_cryo_door_ajar_titanium_leg(self):
50 "The door is ajar and we touch it with the titanium leg. It opens." 38 "The door is ajar and we touch it with the titanium leg. It opens."
51 39
52 self.state.add_inventory_item('titanium_leg') 40 self.state.add_inventory_item('titanium_leg')
53 self.set_game_data('door', 'ajar', 'cryo.door') 41 self.set_game_data('door', 'ajar', 'cryo.door')
54 self.assert_game_data('accessible', True)
55 self.assert_game_data('accessible', False, scene='bridge')
56 42
57 self.interact_thing('cryo.door', 'titanium_leg') 43 self.interact_thing('cryo.door', 'titanium_leg')
58 44
59 self.assert_game_data('accessible', True)
60 self.assert_game_data('accessible', True, scene='bridge')
61 self.assert_game_data('door', 'open', 'cryo.door') 45 self.assert_game_data('door', 'open', 'cryo.door')
62 self.assert_inventory_item('titanium_leg', False) 46 self.assert_inventory_item('titanium_leg', True)
63 47
64 def test_cryo_door_open_hand(self): 48 def test_cryo_door_open_hand(self):
65 "The door is open and we touch it with the hand. No change." 49 "The door is open and we touch it with the hand. We go to the map."
66 50
67 self.set_game_data('accessible', True, scene='bridge') 51 self.set_game_data('door', 'open', 'cryo.door')
68 self.set_game_data('open', True, 'cryo.door')
69 52
70 self.interact_thing('cryo.door') 53 self.interact_thing('cryo.door')
71 54
72 self.assert_game_data('accessible', True) 55 self.assert_game_data('door', 'open', 'cryo.door')
73 self.assert_game_data('accessible', True, scene='bridge') 56 self.assertEquals('map', self.state.current_scene.name)
74 self.assert_game_data('open', True, 'cryo.door')
75 57
76 def test_cryo_door_open_titanium_leg(self): 58 def test_cryo_door_open_titanium_leg(self):
77 "The door is open and we touch it with the titanium leg. No change." 59 "The door is open and we touch it with the titanium leg. No change."
78 60
79 self.set_game_data('accessible', True, scene='bridge') 61 self.set_game_data('door', 'open', 'cryo.door')
80 self.set_game_data('open', True, 'cryo.door')
81 62
82 self.interact_thing('cryo.door', 'titanium_leg') 63 self.interact_thing('cryo.door', 'titanium_leg')
83 64
84 self.assert_game_data('accessible', True) 65 self.assert_game_data('door', 'open', 'cryo.door')
85 self.assert_game_data('accessible', True, scene='bridge') 66 self.assertEquals('cryo', self.state.current_scene.name)
86 self.assert_game_data('open', True, 'cryo.door')
87 67
88 def test_cryo_unit_alpha_full_hand(self): 68 def test_cryo_unit_alpha_full_hand(self):
89 "The cryo unit has the leg in it and we touch it. We get the leg." 69 "The cryo unit has the leg in it and we touch it. We get the leg."
90 70
71 self.state.set_current_detail('cryo_detail')
91 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') 72 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1')
92 self.assert_inventory_item('titanium_leg', False) 73 self.assert_inventory_item('titanium_leg', False)
74 self.assert_detail_thing('cryo.titanium_leg', True)
93 75
94 self.interact_thing('cryo.unit.1') 76 self.interact_thing('cryo.titanium_leg', detail='cryo_detail')
95 77
96 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') 78 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1')
97 self.assert_inventory_item('titanium_leg', True) 79 self.assert_inventory_item('titanium_leg', True)
80 self.assert_detail_thing('cryo.titanium_leg', False)
81
82 def test_cryo_unit_detail(self):
83 "The cryo unit thing opens a detail window."
84
85 resp = self.interact_thing('cryo.unit.1')
86
87 self.assertEquals('cryo_detail', resp.detail_view)
88