Beispiel #1
0
 def test_ease_tween_length_1(self):
     tween = Tween(3)
     tween.ease(9, 1, test_linear())
     self.assertEqual(len(tween), 1)
     expected = [9]
     for i, v in enumerate(tween):
         self.assertAlmostEqual(v, expected[i])
     self.assertEqual(i, 0)
Beispiel #2
0
 def test_ease_tween(self):
     tween = Tween(3)
     tween.ease(9, 10, test_linear())
     self.assertEqual(len(tween), 10)
     expected = [3.6, 4.2, 4.8, 5.4, 6.0, 6.6, 7.2, 7.8, 8.4, 9]
     for i, v in enumerate(tween):
         self.assertAlmostEqual(v, expected[i])
     self.assertEqual(i, 9)
Beispiel #3
0
 def test_ease_tweenvector_length_1(self):
     tween = TweenVector((0, 0, 0))
     tween.ease((5, 10, 15), 1, test_linear())
     self.assertEqual(len(tween), 1)
     expected = [[5, 10, 15]]
     for i, v in enumerate(tween):
         self.assertAlmostEqual(v, expected[i])
     self.assertEqual(i, 0)
Beispiel #4
0
 def test_ease_tweenvector(self):
     tween = TweenVector((0, 0, 0))
     tween.ease((5, 10, 15), 5, test_linear())
     self.assertEqual(len(tween), 5)
     expected = [[1, 2, 3], [2, 4, 6], [3, 6, 9], [4, 8, 12], [5, 10, 15]]
     for i, v in enumerate(tween):
         self.assertAlmostEqual(v, expected[i])
     self.assertEqual(i, 4)
Beispiel #5
0
 def test_ease_tween_length_0(self):
     tween = Tween(3)
     tween.ease(9, 0, test_linear())
     self.assertEqual(len(tween), 0)
Beispiel #6
0
 def test_ease_tweenvector_length_0(self):
     tween = TweenVector((0, 0, 0))
     tween.ease((5, 10, 15), 0, test_linear())
     self.assertEqual(len(tween), 0)