annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
1 import game_logic_utils
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
2
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
3
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
4 class TestGameLogic(game_logic_utils.GameLogicTestCase):
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
5
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
6 CURRENT_SCENE = 'cryo'
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
7
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
12
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
13 self.interact_thing('cryo.door')
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
16
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
17 def test_cryo_door_closed_titanium_leg(self):
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
18 "The door is closed and we touch it with the titanium leg. It opens."
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
42
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
43 self.interact_thing('cryo.door', 'titanium_leg')
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
47
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
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
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
52
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
53 self.interact_thing('cryo.door')
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
54
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
55 self.assert_game_data('door', 'open', 'cryo.door')
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
56 self.assertEquals('map', self.state.current_scene.name)
60
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
57
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
58 def test_cryo_door_open_titanium_leg(self):
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
59 "The door is open and we touch it with the titanium leg. No change."
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
60
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
61 self.set_game_data('door', 'open', 'cryo.door')
60
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
62
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
63 self.interact_thing('cryo.door', 'titanium_leg')
90b32447b239 Some test refactorage.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
64
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
65 self.assert_game_data('door', 'open', 'cryo.door')
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
66 self.assertEquals('cryo', self.state.current_scene.name)
67
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
67
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
68 def test_cryo_unit_alpha_full_hand(self):
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
69 "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
70
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
71 self.state.set_current_detail('cryo_detail')
67
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
72 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
73 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
74 self.assert_detail_thing('cryo.titanium_leg', True)
67
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
75
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
76 self.interact_thing('cryo.titanium_leg', detail='cryo_detail')
67
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
77
6b0f7364f3bf Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents: 60
diff changeset
78 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
79 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
80 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
81
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
82 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
83 "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
84
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
85 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
86
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 98
diff changeset
87 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
88