Changeset 290 for trunk/game


Ignore:
Timestamp:
09/27/09 18:58:36 (10 years ago)
Author:
orlandov
Message:

Add a new test to fix broken unit test introduced by or1andov--

Location:
trunk/game
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/dialogue.py

    r288 r290  
    6262        self.section_stack = [] 
    6363 
    64         self.callbacks['npc_avatar'](self.tree['AVATAR']) 
     64        self.callbacks['npc_avatar'](self.state, self.tree['AVATAR']) 
    6565 
    6666        try: 
  • trunk/game/scripts/dialoguegui.py

    r288 r290  
    121121        self.npc.behaviour.idle() 
    122122 
    123     def handleAvatarImage(self, image): 
     123    def handleAvatarImage(self, state, image): 
    124124        """Callback to handle when the dialogue engine wants to set the NPC image 
    125125           @type image: str 
  • trunk/game/tests/test_dialogue.py

    r287 r290  
    2424        self.tree = { 
    2525            'START': 'main', 
     26            'AVATAR': 'npc.png', 
    2627            'SECTIONS': { 
    2728                'main': [ 
     
    5960        self.replies = ["resp1", "back", "stop"] 
    6061 
     62        def npc_avatar_cb(state, image): 
     63            state['npc_avatar'] = image 
     64 
    6165        def responses_cb(state, responses): 
    6266            state['responses'] = responses 
     
    6468        callbacks = { 
    6569            "say": say_cb, 
    66             "responses": responses_cb 
     70            "responses": responses_cb, 
     71            "npc_avatar": npc_avatar_cb 
    6772        } 
    6873 
     
    7580        self.assertEqual(responses, self.dialogue.state['responses']) 
    7681 
     82    def assert_npc_image(self, image): 
     83        self.assertEqual(image, self.dialogue.state['npc_avatar']) 
     84 
    7785    def test_simple(self): 
    7886        """Test basic dialogue interaction""" 
     
    8088        self.dialogue.run() 
    8189 
     90        self.assert_npc_image('npc.png') 
    8291        self.assert_say('Greetings stranger') 
    8392        self.assert_responses([ 
Note: See TracChangeset for help on using the changeset viewer.