Exemple #1
0
 def testCharactorPlaceNotification(self):
     """Test charactor place notification"""
     map_state = MapState(self.event_manager)
     charactor = Charactor(self.event_manager)
     charactor.sector = Sector()
     charactor_place_event = CharactorPlaceEvent(charactor)
     self.event_manager.post(charactor_place_event)
     self.assertEqual(map_state.actors_by_sector_id[charactor.sector.sector_id], charactor)
     self.assertEqual(map_state.occupied_sectors_by_actor_id[charactor.charactor_id], charactor.sector)
Exemple #2
0
 def testFreeSectorActionNotification(self):
     """Test free section action notification"""
     map_state = MapState(self.event_manager)
     sector = Sector()
     
     self.actionExecuted = False #TODO: this is no good
     def function(sector_is_free):
         if sector_is_free:
             self.actionExecuted = True
     callback_function = function
     free_sector_action = FreeSectorAction(sector, callback_function)
     self.event_manager.post(free_sector_action)
     self.assertTrue(self.actionExecuted)
     
     self.actionExecuted = False
     charactor = Charactor(self.event_manager)
     charactor.sector = sector
     map_state.occupied_sectors_by_actor_id[charactor.charactor_id] = charactor.sector
     self.event_manager.post(free_sector_action)
     self.assertFalse(self.actionExecuted)