comparison gamelib/tests/test_scene_interactions_cryo.py @ 98:e97244b1be30

Fix tests for new tristate door logic.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 24 Aug 2010 08:11:10 +0200
parents 6b0f7364f3bf
children 30f2308c1efc
comparison
equal deleted inserted replaced
97:60770ca02c1a 98:e97244b1be30
4 class TestGameLogic(game_logic_utils.GameLogicTestCase): 4 class TestGameLogic(game_logic_utils.GameLogicTestCase):
5 5
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. No change." 9 "The door is closed and we touch it with the hand. It becomes ajar."
10 10
11 self.assert_game_data('accessible', True) 11 self.assert_game_data('accessible', True)
12 self.assert_game_data('accessible', False, scene='bridge') 12 self.assert_game_data('accessible', False, scene='bridge')
13 self.assert_game_data('open', False, 'cryo.door') 13 self.assert_game_data('door', 'shut', 'cryo.door')
14 14
15 self.interact_thing('cryo.door') 15 self.interact_thing('cryo.door')
16 16
17 self.assert_game_data('accessible', True) 17 self.assert_game_data('accessible', True)
18 self.assert_game_data('accessible', False, scene='bridge') 18 self.assert_game_data('accessible', False, scene='bridge')
19 self.assert_game_data('open', False, 'cryo.door') 19 self.assert_game_data('door', 'ajar', 'cryo.door')
20 20
21 def test_cryo_door_closed_titanium_leg(self): 21 def test_cryo_door_closed_titanium_leg(self):
22 "The door is closed and we touch it with the titanium leg. It opens." 22 "The door is closed and we touch it with the titanium leg. It opens."
23 23
24 self.state.add_inventory_item('titanium_leg') 24 self.state.add_inventory_item('titanium_leg')
25 self.assert_game_data('accessible', True) 25 self.assert_game_data('accessible', True)
26 self.assert_game_data('accessible', False, scene='bridge') 26 self.assert_game_data('accessible', False, scene='bridge')
27 self.assert_game_data('open', False, 'cryo.door') 27 self.assert_game_data('door', 'shut', 'cryo.door')
28
29 self.interact_thing('cryo.door', 'titanium_leg')
30
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')
34 self.assert_inventory_item('titanium_leg', True)
35
36 def test_cryo_door_ajar_hand(self):
37 "The door is ajar and we touch it with the hand. No change."
38
39 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
43 self.interact_thing('cryo.door')
44
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')
48
49 def test_cryo_door_ajar_titanium_leg(self):
50 "The door is ajar and we touch it with the titanium leg. It opens."
51
52 self.state.add_inventory_item('titanium_leg')
53 self.set_game_data('door', 'ajar', 'cryo.door')
54 self.assert_game_data('accessible', True)
55 self.assert_game_data('accessible', False, scene='bridge')
28 56
29 self.interact_thing('cryo.door', 'titanium_leg') 57 self.interact_thing('cryo.door', 'titanium_leg')
30 58
31 self.assert_game_data('accessible', True) 59 self.assert_game_data('accessible', True)
32 self.assert_game_data('accessible', True, scene='bridge') 60 self.assert_game_data('accessible', True, scene='bridge')
33 self.assert_game_data('open', True, 'cryo.door') 61 self.assert_game_data('door', 'open', 'cryo.door')
34 self.assert_inventory_item('titanium_leg', False) 62 self.assert_inventory_item('titanium_leg', False)
35 63
36 def test_cryo_door_open_hand(self): 64 def test_cryo_door_open_hand(self):
37 "The door is open and we touch it with the hand. No change." 65 "The door is open and we touch it with the hand. No change."
38 66