Mercurial > pyntnclick
annotate gamelib/tests/test_scene_interactions_cryo.py @ 280:d9b19449436f
The flying fish fix (take 1)
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Fri, 27 Aug 2010 22:35:09 +0200 |
parents | ca0c2875ad8f |
children | bfb6c682b4fb |
rev | line source |
---|---|
60 | 1 import game_logic_utils |
2 | |
3 | |
4 class TestGameLogic(game_logic_utils.GameLogicTestCase): | |
5 | |
6 CURRENT_SCENE = 'cryo' | |
7 | |
8 def test_cryo_door_closed_hand(self): | |
98
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
9 "The door is closed and we touch it with the hand. It becomes ajar." |
60 | 10 |
98
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
11 self.assert_game_data('door', 'shut', 'cryo.door') |
60 | 12 |
13 self.interact_thing('cryo.door') | |
14 | |
98
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
15 self.assert_game_data('door', 'ajar', 'cryo.door') |
60 | 16 |
17 def test_cryo_door_closed_titanium_leg(self): | |
18 "The door is closed and we touch it with the titanium leg. It opens." | |
19 | |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
20 self.state.add_inventory_item('titanium_leg') |
98
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
21 self.assert_game_data('door', 'shut', 'cryo.door') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
22 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
23 self.interact_thing('cryo.door', 'titanium_leg') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
24 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
25 self.assert_game_data('door', 'shut', 'cryo.door') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
26 self.assert_inventory_item('titanium_leg', True) |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
27 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
28 def test_cryo_door_ajar_hand(self): |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
29 "The door is ajar and we touch it with the hand. No change." |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
30 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
31 self.set_game_data('door', 'ajar', 'cryo.door') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
32 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
33 self.interact_thing('cryo.door') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
34 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
35 self.assert_game_data('door', 'ajar', 'cryo.door') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
36 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
37 def test_cryo_door_ajar_titanium_leg(self): |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
38 "The door is ajar and we touch it with the titanium leg. It opens." |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
39 |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
40 self.state.add_inventory_item('titanium_leg') |
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
41 self.set_game_data('door', 'ajar', 'cryo.door') |
60 | 42 |
43 self.interact_thing('cryo.door', 'titanium_leg') | |
44 | |
98
e97244b1be30
Fix tests for new tristate door logic.
Jeremy Thurgood <firxen@gmail.com>
parents:
67
diff
changeset
|
45 self.assert_game_data('door', 'open', 'cryo.door') |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
46 self.assert_inventory_item('titanium_leg', True) |
60 | 47 |
48 def test_cryo_door_open_hand(self): | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
49 "The door is open and we touch it with the hand. We go to the map." |
60 | 50 |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
51 self.set_game_data('door', 'open', 'cryo.door') |
60 | 52 |
53 self.interact_thing('cryo.door') | |
54 | |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
247
diff
changeset
|
55 self.assert_game_data('door', 'open', 'cryo.door', scene='cryo') |
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
247
diff
changeset
|
56 self.assert_current_scene('map') |
60 | 57 |
58 def test_cryo_door_open_titanium_leg(self): | |
59 "The door is open and we touch it with the titanium leg. No change." | |
60 | |
254 | 61 self.state.add_inventory_item('titanium_leg') |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
62 self.set_game_data('door', 'open', 'cryo.door') |
60 | 63 |
64 self.interact_thing('cryo.door', 'titanium_leg') | |
65 | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
66 self.assert_game_data('door', 'open', 'cryo.door') |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
247
diff
changeset
|
67 self.assert_current_scene('cryo') |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
68 |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
69 def test_cryo_unit_alpha_full_hand(self): |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
70 "The cryo unit has the leg in it and we touch it. We get the leg." |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
71 |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
72 self.state.set_current_detail('cryo_detail') |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
73 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
74 self.assert_inventory_item('titanium_leg', False) |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
75 self.assert_detail_thing('cryo.titanium_leg', True) |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
76 |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
247
diff
changeset
|
77 self.interact_thing('cryo.titanium_leg') |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
78 |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
79 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
60
diff
changeset
|
80 self.assert_inventory_item('titanium_leg', True) |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
81 self.assert_detail_thing('cryo.titanium_leg', False) |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
82 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
83 def test_cryo_unit_detail(self): |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
84 "The cryo unit thing opens a detail window." |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
85 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
86 resp = self.interact_thing('cryo.unit.1') |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
87 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
88 self.assertEquals('cryo_detail', resp.detail_view) |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
98
diff
changeset
|
89 |
247
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
90 def test_pipes_unchopped_hand(self): |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
91 "Touch the unchopped cryopipes with the hand. No change." |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
92 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
93 self.assert_game_data('fixed', True, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
94 self.assert_game_data('fixed', True, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
95 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
96 self.assertNotEquals(None, self.interact_thing('cryo.pipe.left')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
97 self.assertNotEquals(None, self.interact_thing('cryo.pipe.right')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
98 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
99 self.assert_game_data('fixed', True, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
100 self.assert_game_data('fixed', True, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
101 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
102 def test_pipes_chopped_hand(self): |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
103 "Touch the chopped cryopipes with the hand. No change." |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
104 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
105 self.set_game_data('fixed', False, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
106 self.set_game_data('fixed', False, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
107 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
108 self.assertEquals(None, self.interact_thing('cryo.pipe.left')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
109 self.assertEquals(None, self.interact_thing('cryo.pipe.right')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
110 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
111 self.assert_game_data('fixed', False, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
112 self.assert_game_data('fixed', False, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
113 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
114 def test_pipes_unchopped_machete(self): |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
115 "Touch the unchopped cryopipes with the machete. They chop." |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
116 |
254 | 117 self.state.add_inventory_item('machete') |
247
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
118 self.assert_game_data('fixed', True, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
119 self.assert_game_data('fixed', True, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
120 self.assert_item_exists('cryo_pipe.0', False) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
121 self.assert_item_exists('cryo_pipe.1', False) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
122 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
123 self.assertNotEquals(None, self.interact_thing('cryo.pipe.left', 'machete')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
124 self.assertNotEquals(None, self.interact_thing('cryo.pipe.right', 'machete')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
125 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
126 self.assert_game_data('fixed', False, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
127 self.assert_game_data('fixed', False, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
128 self.assert_item_exists('cryo_pipe.0') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
129 self.assert_item_exists('cryo_pipe.1') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
130 self.assert_inventory_item('cryo_pipe.0', True) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
131 self.assert_inventory_item('cryo_pipe.1', True) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
132 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
133 def test_pipes_chopped_machete(self): |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
134 "Touch the chopped cryopipes with the machete. No change." |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
135 |
254 | 136 self.state.add_inventory_item('machete') |
247
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
137 self.set_game_data('fixed', False, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
138 self.set_game_data('fixed', False, 'cryo.pipe.right') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
139 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
140 self.assertEquals(None, self.interact_thing('cryo.pipe.left', 'machete')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
141 self.assertEquals(None, self.interact_thing('cryo.pipe.right', 'machete')) |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
142 |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
143 self.assert_game_data('fixed', False, 'cryo.pipe.left') |
0bad554d0926
More tests, some cryo room fixes and docs in the build.
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
144 self.assert_game_data('fixed', False, 'cryo.pipe.right') |