Mercurial > pyntnclick
comparison gamelib/tests/test_scene_interactions_cryo.py @ 854:3577c51029f1 default tip
Remove Suspended Sentence. pyntnclick is the library we extracted from it
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 21 Jun 2014 22:15:54 +0200 |
parents | f95830b58336 |
children |
comparison
equal
deleted
inserted
replaced
853:f95830b58336 | 854:3577c51029f1 |
---|---|
1 from pyntnclick.tests.game_logic_utils import GameLogicTestCase | |
2 | |
3 import gamelib.main | |
4 | |
5 | |
6 class TestGameLogic(GameLogicTestCase): | |
7 | |
8 GAME_DESCRIPTION_CLASS = gamelib.main.SuspendedSentence | |
9 CURRENT_SCENE = 'cryo' | |
10 | |
11 def test_cryo_door_closed_hand(self): | |
12 "The door is closed and we touch it with the hand. It becomes ajar." | |
13 | |
14 self.assert_game_data('door', 'shut', 'cryo.door') | |
15 | |
16 self.interact_thing('cryo.door') | |
17 | |
18 self.assert_game_data('door', 'ajar', 'cryo.door') | |
19 | |
20 def test_cryo_door_closed_titanium_leg(self): | |
21 "The door is closed and we touch it with the titanium leg. It opens." | |
22 | |
23 self.state.add_inventory_item('titanium_leg') | |
24 self.assert_game_data('door', 'shut', 'cryo.door') | |
25 | |
26 self.interact_thing('cryo.door', 'titanium_leg:') | |
27 | |
28 self.assert_game_data('door', 'shut', 'cryo.door') | |
29 self.assert_inventory_item('titanium_leg:', True) | |
30 | |
31 def test_cryo_door_ajar_hand(self): | |
32 "The door is ajar and we touch it with the hand. No change." | |
33 | |
34 self.set_game_data('door', 'ajar', 'cryo.door') | |
35 | |
36 self.interact_thing('cryo.door') | |
37 | |
38 self.assert_game_data('door', 'ajar', 'cryo.door') | |
39 | |
40 def test_cryo_door_ajar_titanium_leg(self): | |
41 "The door is ajar and we touch it with the titanium leg. It opens." | |
42 | |
43 self.state.add_inventory_item('titanium_leg') | |
44 self.set_game_data('door', 'ajar', 'cryo.door') | |
45 | |
46 self.interact_thing('cryo.door', 'titanium_leg:') | |
47 | |
48 self.assert_game_data('door', 'open', 'cryo.door') | |
49 self.assert_inventory_item('titanium_leg:', True) | |
50 | |
51 def test_cryo_door_open_hand(self): | |
52 "The door is open and we touch it with the hand. We go to the map." | |
53 | |
54 self.set_game_data('door', 'open', 'cryo.door') | |
55 | |
56 self.interact_thing('cryo.door') | |
57 | |
58 self.assert_game_data('door', 'open', 'cryo.door', scene='cryo') | |
59 self.assert_current_scene('map') | |
60 | |
61 def test_cryo_door_open_titanium_leg(self): | |
62 "The door is open and we touch it with the titanium leg. No change." | |
63 | |
64 self.state.add_inventory_item('titanium_leg') | |
65 self.set_game_data('door', 'open', 'cryo.door') | |
66 | |
67 self.interact_thing('cryo.door', 'titanium_leg:') | |
68 | |
69 self.assert_game_data('door', 'open', 'cryo.door') | |
70 self.assert_current_scene('cryo') | |
71 | |
72 def test_cryo_unit_alpha_full_hand(self): | |
73 "The cryo unit has the leg in it and we touch it. We get the leg." | |
74 | |
75 self.interact_thing('cryo.unit.1') | |
76 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') | |
77 self.assert_inventory_item('titanium_leg:', False) | |
78 self.assert_detail_thing('cryo.titanium_leg', True) | |
79 | |
80 self.interact_thing('cryo.titanium_leg', detail='cryo_detail') | |
81 | |
82 self.assert_inventory_item('titanium_leg:', True) | |
83 self.assert_detail_thing('cryo.titanium_leg', False) | |
84 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') | |
85 | |
86 def test_cryo_unit_detail(self): | |
87 "The cryo unit thing opens a detail window." | |
88 | |
89 resp = self.interact_thing('cryo.unit.1') | |
90 | |
91 self.assertEquals('cryo_detail', resp.detail_view) | |
92 | |
93 def test_pipes_unchopped_hand(self): | |
94 "Touch the unchopped cryopipes with the hand. No change." | |
95 | |
96 self.assert_game_data('fixed', True, 'cryo.pipe.left') | |
97 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') | |
98 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') | |
99 | |
100 self.assertNotEquals(None, self.interact_thing('cryo.pipe.left')) | |
101 self.assertNotEquals(None, self.interact_thing('cryo.pipe.right.top')) | |
102 self.assertNotEquals(None, | |
103 self.interact_thing('cryo.pipe.right.bottom')) | |
104 | |
105 self.assert_game_data('fixed', True, 'cryo.pipe.left') | |
106 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') | |
107 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') | |
108 | |
109 def test_pipes_chopped_hand(self): | |
110 "Touch the chopped cryopipes with the hand. No change." | |
111 | |
112 self.set_game_data('fixed', False, 'cryo.pipe.left') | |
113 self.set_game_data('fixed', False, 'cryo.pipe.right.top') | |
114 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom') | |
115 | |
116 self.assertEquals(None, self.interact_thing('cryo.pipe.left')) | |
117 self.assertEquals(None, self.interact_thing('cryo.pipe.right.top')) | |
118 self.assertEquals(None, self.interact_thing('cryo.pipe.right.bottom')) | |
119 | |
120 self.assert_game_data('fixed', False, 'cryo.pipe.left') | |
121 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') | |
122 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') | |
123 | |
124 def test_pipes_unchopped_machete(self): | |
125 "Touch the unchopped cryopipes with the machete. They chop." | |
126 | |
127 self.state.add_inventory_item('machete') | |
128 self.assert_game_data('fixed', True, 'cryo.pipe.left') | |
129 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') | |
130 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') | |
131 self.assert_item_exists('cryo_pipe:0', False) | |
132 self.assert_item_exists('cryo_pipe:1', False) | |
133 self.assert_item_exists('cryo_pipe:2', False) | |
134 | |
135 self.assertNotEquals( | |
136 None, self.interact_thing('cryo.pipe.left', 'machete:')) | |
137 self.assertNotEquals( | |
138 None, self.interact_thing('cryo.pipe.right.top', 'machete:')) | |
139 self.assertNotEquals( | |
140 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:')) | |
141 | |
142 self.assert_game_data('fixed', False, 'cryo.pipe.left') | |
143 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') | |
144 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') | |
145 self.assert_item_exists('tube_fragment:0') | |
146 self.assert_item_exists('tube_fragment:1') | |
147 self.assert_item_exists('tube_fragment:2') | |
148 self.assert_inventory_item('tube_fragment:0', True) | |
149 self.assert_inventory_item('tube_fragment:1', True) | |
150 self.assert_inventory_item('tube_fragment:2', True) | |
151 | |
152 def test_pipes_chopped_machete(self): | |
153 "Touch the chopped cryopipes with the machete. No change." | |
154 | |
155 self.state.add_inventory_item('machete') | |
156 self.set_game_data('fixed', False, 'cryo.pipe.left') | |
157 self.set_game_data('fixed', False, 'cryo.pipe.right.top') | |
158 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom') | |
159 | |
160 self.assertEquals( | |
161 None, self.interact_thing('cryo.pipe.left', 'machete:')) | |
162 self.assertEquals( | |
163 None, self.interact_thing('cryo.pipe.right.top', 'machete:')) | |
164 self.assertEquals( | |
165 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:')) | |
166 | |
167 self.assert_game_data('fixed', False, 'cryo.pipe.left') | |
168 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') | |
169 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') |