Exemple #1
0
    def testNotifyTickEvent(self):
        """Test notifying bullets about tick event"""
        bullets = Bullets(self.event_manager)

        def register_move_bullets_call():
            register_move_bullets_call.called = True

        bullets.move_bullets = register_move_bullets_call
        bullets.move_bullets.called = False
        event = TickEvent()
        bullets.notify(event)
        # there are no bullets -> False
        self.assertFalse(bullets.move_bullets.called)
        bullets.create_bullet(Sector(), 0)
        bullets.notify(event)
        self.assertTrue(bullets.move_bullets.called)
Exemple #2
0
 def testMoveBullets(self):
     """Test moving bullets"""
     bullets = Bullets(self.event_manager)
     bullets.move_bullets()
     self.assertTrue(isinstance(self.event_tester.last_event(), BulletsMoveEvent))