| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <body> | 5 <body> |
| 6 <div id='e'></div> | 6 <div id='e'></div> |
| 7 </body> | 7 </body> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 var element = document.getElementById('e'); | 10 var element = document.getElementById('e'); |
| 11 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; | 11 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; |
| 12 | 12 |
| 13 test(function() { | 13 test(function() { |
| 14 var animation = new Animation(element, keyframes); | 14 var animation = new Animation(element, keyframes); |
| 15 assert_equals(animation.localTime, null); | 15 assert_equals(animation.localTime, null); |
| 16 assert_equals(animation.currentIteration, null); | 16 assert_equals(animation.currentIteration, null); |
| 17 }, 'TimedItem.localTime and TimedItem.currentIteration are null when animation i
s not associated with a Player'); | 17 }, 'TimedItem.localTime and TimedItem.currentIteration are null when animation i
s not associated with a Player'); |
| 18 | 18 |
| 19 test(function() { | 19 test(function() { |
| 20 var animation = element.animate(keyframes, {fill: 'both', duration: 2, itera
tions: 3}).source; | 20 var animation = element.animate(keyframes, {fill: 'both', duration: 2000, it
erations: 3}).source; |
| 21 animation.player.currentTime = -1; | 21 animation.player.currentTime = -1000; |
| 22 assert_equals(animation.localTime, -1); | 22 assert_equals(animation.localTime, -1000, 'localTime'); |
| 23 assert_equals(animation.currentIteration, 0); | 23 assert_equals(animation.currentIteration, 0); |
| 24 animation.player.currentTime = 1; | 24 animation.player.currentTime = 1000; |
| 25 assert_equals(animation.localTime, 1); | 25 assert_equals(animation.localTime, 1000); |
| 26 assert_equals(animation.currentIteration, 0); | 26 assert_equals(animation.currentIteration, 0); |
| 27 animation.player.currentTime = 5; | 27 animation.player.currentTime = 5000; |
| 28 assert_equals(animation.localTime, 5); | 28 assert_equals(animation.localTime, 5000); |
| 29 assert_equals(animation.currentIteration, 2); | 29 assert_equals(animation.currentIteration, 2); |
| 30 animation.player.currentTime = 7; | 30 animation.player.currentTime = 7000; |
| 31 assert_equals(animation.localTime, 7); | 31 assert_equals(animation.localTime, 7000); |
| 32 assert_equals(animation.currentIteration, 2); | 32 assert_equals(animation.currentIteration, 2); |
| 33 }, 'TimedItem.localTime and TimedItem.currentIteration return reasonable values
when an animation is in effect'); | 33 }, 'TimedItem.localTime and TimedItem.currentIteration return reasonable values
when an animation is in effect'); |
| 34 | 34 |
| 35 test(function() { | 35 test(function() { |
| 36 var animation = element.animate(keyframes).source; | 36 var animation = element.animate(keyframes).source; |
| 37 animation.player.currentTime = -1; | 37 animation.player.currentTime = -1; |
| 38 assert_equals(animation.currentIteration, null); | 38 assert_equals(animation.currentIteration, null); |
| 39 animation.player.currentTime = 1; | 39 animation.player.currentTime = 1; |
| 40 assert_equals(animation.currentIteration, null); | 40 assert_equals(animation.currentIteration, null); |
| 41 }, 'TimedItem.currentIteration is null when animation is not in effect'); | 41 }, 'TimedItem.currentIteration is null when animation is not in effect'); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 assert_equals(animation.duration, 3); | 55 assert_equals(animation.duration, 3); |
| 56 assert_equals(animation.activeDuration, 12); | 56 assert_equals(animation.activeDuration, 12); |
| 57 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for anim
ations with delays and iterations'); | 57 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for anim
ations with delays and iterations'); |
| 58 | 58 |
| 59 test(function() { | 59 test(function() { |
| 60 var animation = new Animation(element, keyframes, {delay: 1}); | 60 var animation = new Animation(element, keyframes, {delay: 1}); |
| 61 assert_equals(animation.duration, 0); | 61 assert_equals(animation.duration, 0); |
| 62 }, 'TimedItem duration is calculated when no duration is specified'); | 62 }, 'TimedItem duration is calculated when no duration is specified'); |
| 63 | 63 |
| 64 </script> | 64 </script> |
| OLD | NEW |