Example #1
0
    def test_reset(self):
        animation = Animation(ClockDummy(1), ["img1", "img2"], [1, 1])

        animation.reset()
        self.assertEqual(animation.getSprite(), "img1")
        animation.update()
        animation.reset()
        self.assertEqual(animation.getSprite(), "img1")
Example #2
0
    def test_update_basic(self):
        animation = Animation(ClockDummy(1), ["img1", "img2", "img3"], [1, 1, 1])

        self.assertEqual(animation.getSprite(), "img1")
        animation.update()
        self.assertEqual(animation.getSprite(), "img2")
        animation.update()
        self.assertEqual(animation.getSprite(), "img3")
Example #3
0
 def test_incrementSpriteIndex(self):
     animation = Animation(ClockDummy(1), ["img1", "img2", "img3"], [1, 1, 1])
     self.assertEqual(animation.getSprite(), "img1")
     animation.incrementSpriteIndex()
     self.assertEqual(animation.getSprite(), "img2")
     animation.incrementSpriteIndex()
     self.assertEqual(animation.getSprite(), "img3")
     animation.incrementSpriteIndex()
     self.assertEqual(animation.getSprite(), "img1")
Example #4
0
    def test_update_advanced(self):
        animation = Animation(ClockDummy(3), ["img1", "img2", "img3"], [2, 1, 5])

        self.assertEqual(animation.getSprite(), "img1")
        animation.update()
        self.assertEqual(animation.getSprite(), "img3")
        animation.update()
        self.assertEqual(animation.getSprite(), "img3")
        animation.update()
        self.assertEqual(animation.getSprite(), "img1")
        animation.update()
        self.assertEqual(animation.getSprite(), "img3")