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")
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")
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")
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")