Mercurial > boomslang
comparison gamelib/tests/test_scene_interactions_cryo.py @ 852:f95830b58336
Merge pyntnclick
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 21 Jun 2014 22:04:35 +0200 |
parents | eed75a1d50c4 |
children |
comparison
equal
deleted
inserted
replaced
546:ad4d6ffd25d7 | 852:f95830b58336 |
---|---|
1 import game_logic_utils | 1 from pyntnclick.tests.game_logic_utils import GameLogicTestCase |
2 | |
3 import gamelib.main | |
2 | 4 |
3 | 5 |
4 class TestGameLogic(game_logic_utils.GameLogicTestCase): | 6 class TestGameLogic(GameLogicTestCase): |
5 | 7 |
8 GAME_DESCRIPTION_CLASS = gamelib.main.SuspendedSentence | |
6 CURRENT_SCENE = 'cryo' | 9 CURRENT_SCENE = 'cryo' |
7 | 10 |
8 def test_cryo_door_closed_hand(self): | 11 def test_cryo_door_closed_hand(self): |
9 "The door is closed and we touch it with the hand. It becomes ajar." | 12 "The door is closed and we touch it with the hand. It becomes ajar." |
10 | 13 |
18 "The door is closed and we touch it with the titanium leg. It opens." | 21 "The door is closed and we touch it with the titanium leg. It opens." |
19 | 22 |
20 self.state.add_inventory_item('titanium_leg') | 23 self.state.add_inventory_item('titanium_leg') |
21 self.assert_game_data('door', 'shut', 'cryo.door') | 24 self.assert_game_data('door', 'shut', 'cryo.door') |
22 | 25 |
23 self.interact_thing('cryo.door', 'titanium_leg') | 26 self.interact_thing('cryo.door', 'titanium_leg:') |
24 | 27 |
25 self.assert_game_data('door', 'shut', 'cryo.door') | 28 self.assert_game_data('door', 'shut', 'cryo.door') |
26 self.assert_inventory_item('titanium_leg', True) | 29 self.assert_inventory_item('titanium_leg:', True) |
27 | 30 |
28 def test_cryo_door_ajar_hand(self): | 31 def test_cryo_door_ajar_hand(self): |
29 "The door is ajar and we touch it with the hand. No change." | 32 "The door is ajar and we touch it with the hand. No change." |
30 | 33 |
31 self.set_game_data('door', 'ajar', 'cryo.door') | 34 self.set_game_data('door', 'ajar', 'cryo.door') |
38 "The door is ajar and we touch it with the titanium leg. It opens." | 41 "The door is ajar and we touch it with the titanium leg. It opens." |
39 | 42 |
40 self.state.add_inventory_item('titanium_leg') | 43 self.state.add_inventory_item('titanium_leg') |
41 self.set_game_data('door', 'ajar', 'cryo.door') | 44 self.set_game_data('door', 'ajar', 'cryo.door') |
42 | 45 |
43 self.interact_thing('cryo.door', 'titanium_leg') | 46 self.interact_thing('cryo.door', 'titanium_leg:') |
44 | 47 |
45 self.assert_game_data('door', 'open', 'cryo.door') | 48 self.assert_game_data('door', 'open', 'cryo.door') |
46 self.assert_inventory_item('titanium_leg', True) | 49 self.assert_inventory_item('titanium_leg:', True) |
47 | 50 |
48 def test_cryo_door_open_hand(self): | 51 def test_cryo_door_open_hand(self): |
49 "The door is open and we touch it with the hand. We go to the map." | 52 "The door is open and we touch it with the hand. We go to the map." |
50 | 53 |
51 self.set_game_data('door', 'open', 'cryo.door') | 54 self.set_game_data('door', 'open', 'cryo.door') |
59 "The door is open and we touch it with the titanium leg. No change." | 62 "The door is open and we touch it with the titanium leg. No change." |
60 | 63 |
61 self.state.add_inventory_item('titanium_leg') | 64 self.state.add_inventory_item('titanium_leg') |
62 self.set_game_data('door', 'open', 'cryo.door') | 65 self.set_game_data('door', 'open', 'cryo.door') |
63 | 66 |
64 self.interact_thing('cryo.door', 'titanium_leg') | 67 self.interact_thing('cryo.door', 'titanium_leg:') |
65 | 68 |
66 self.assert_game_data('door', 'open', 'cryo.door') | 69 self.assert_game_data('door', 'open', 'cryo.door') |
67 self.assert_current_scene('cryo') | 70 self.assert_current_scene('cryo') |
68 | 71 |
69 def test_cryo_unit_alpha_full_hand(self): | 72 def test_cryo_unit_alpha_full_hand(self): |
70 "The cryo unit has the leg in it and we touch it. We get the leg." | 73 "The cryo unit has the leg in it and we touch it. We get the leg." |
71 | 74 |
75 self.interact_thing('cryo.unit.1') | |
72 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') | 76 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') |
73 self.state.set_current_detail('cryo_detail') | 77 self.assert_inventory_item('titanium_leg:', False) |
74 self.assert_inventory_item('titanium_leg', False) | |
75 self.assert_detail_thing('cryo.titanium_leg', True) | 78 self.assert_detail_thing('cryo.titanium_leg', True) |
76 | 79 |
77 self.interact_thing('cryo.titanium_leg') | 80 self.interact_thing('cryo.titanium_leg', detail='cryo_detail') |
78 | 81 |
79 self.assert_inventory_item('titanium_leg', True) | 82 self.assert_inventory_item('titanium_leg:', True) |
80 self.assert_detail_thing('cryo.titanium_leg', False) | 83 self.assert_detail_thing('cryo.titanium_leg', False) |
81 self.close_detail() | |
82 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') | 84 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') |
83 | 85 |
84 def test_cryo_unit_detail(self): | 86 def test_cryo_unit_detail(self): |
85 "The cryo unit thing opens a detail window." | 87 "The cryo unit thing opens a detail window." |
86 | 88 |
124 | 126 |
125 self.state.add_inventory_item('machete') | 127 self.state.add_inventory_item('machete') |
126 self.assert_game_data('fixed', True, 'cryo.pipe.left') | 128 self.assert_game_data('fixed', True, 'cryo.pipe.left') |
127 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') | 129 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') |
128 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') | 130 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') |
129 self.assert_item_exists('cryo_pipe.0', False) | 131 self.assert_item_exists('cryo_pipe:0', False) |
130 self.assert_item_exists('cryo_pipe.1', False) | 132 self.assert_item_exists('cryo_pipe:1', False) |
131 self.assert_item_exists('cryo_pipe.2', False) | 133 self.assert_item_exists('cryo_pipe:2', False) |
132 | 134 |
133 self.assertNotEquals( | 135 self.assertNotEquals( |
134 None, self.interact_thing('cryo.pipe.left', 'machete')) | 136 None, self.interact_thing('cryo.pipe.left', 'machete:')) |
135 self.assertNotEquals( | 137 self.assertNotEquals( |
136 None, self.interact_thing('cryo.pipe.right.top', 'machete')) | 138 None, self.interact_thing('cryo.pipe.right.top', 'machete:')) |
137 self.assertNotEquals( | 139 self.assertNotEquals( |
138 None, self.interact_thing('cryo.pipe.right.bottom', 'machete')) | 140 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:')) |
139 | 141 |
140 self.assert_game_data('fixed', False, 'cryo.pipe.left') | 142 self.assert_game_data('fixed', False, 'cryo.pipe.left') |
141 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') | 143 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') |
142 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') | 144 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') |
143 self.assert_item_exists('tube_fragment.0') | 145 self.assert_item_exists('tube_fragment:0') |
144 self.assert_item_exists('tube_fragment.1') | 146 self.assert_item_exists('tube_fragment:1') |
145 self.assert_item_exists('tube_fragment.2') | 147 self.assert_item_exists('tube_fragment:2') |
146 self.assert_inventory_item('tube_fragment.0', True) | 148 self.assert_inventory_item('tube_fragment:0', True) |
147 self.assert_inventory_item('tube_fragment.1', True) | 149 self.assert_inventory_item('tube_fragment:1', True) |
148 self.assert_inventory_item('tube_fragment.2', True) | 150 self.assert_inventory_item('tube_fragment:2', True) |
149 | 151 |
150 def test_pipes_chopped_machete(self): | 152 def test_pipes_chopped_machete(self): |
151 "Touch the chopped cryopipes with the machete. No change." | 153 "Touch the chopped cryopipes with the machete. No change." |
152 | 154 |
153 self.state.add_inventory_item('machete') | 155 self.state.add_inventory_item('machete') |
154 self.set_game_data('fixed', False, 'cryo.pipe.left') | 156 self.set_game_data('fixed', False, 'cryo.pipe.left') |
155 self.set_game_data('fixed', False, 'cryo.pipe.right.top') | 157 self.set_game_data('fixed', False, 'cryo.pipe.right.top') |
156 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom') | 158 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom') |
157 | 159 |
158 self.assertEquals( | 160 self.assertEquals( |
159 None, self.interact_thing('cryo.pipe.left', 'machete')) | 161 None, self.interact_thing('cryo.pipe.left', 'machete:')) |
160 self.assertEquals( | 162 self.assertEquals( |
161 None, self.interact_thing('cryo.pipe.right.top', 'machete')) | 163 None, self.interact_thing('cryo.pipe.right.top', 'machete:')) |
162 self.assertEquals( | 164 self.assertEquals( |
163 None, self.interact_thing('cryo.pipe.right.bottom', 'machete')) | 165 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:')) |
164 | 166 |
165 self.assert_game_data('fixed', False, 'cryo.pipe.left') | 167 self.assert_game_data('fixed', False, 'cryo.pipe.left') |
166 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') | 168 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') |
167 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') | 169 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') |