Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Things</title> | |
| 3 <link rel="https://w3c.github.io/web-animations/#the-animation-interface"> | |
|
nainar
2016/07/12 05:30:33
Should be: https://www.w3.org/TR/web-animations/#t
suzyh_UTC10 (ex-contributor)
2016/07/12 05:39:54
Except from a base of https://w3c.github.io/web-an
nainar
2016/07/12 05:47:31
Done.
| |
| 2 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="../imported/wpt/web-animations/testcommon.js"></script> | |
|
suzyh_UTC10 (ex-contributor)
2016/07/12 05:18:06
Are you using this testcommon script?
nainar
2016/07/12 05:30:33
should I change the ones that are comparing times
suzyh_UTC10 (ex-contributor)
2016/07/12 05:39:54
Oh, good point. Yeah, I guess convert to use asser
nainar
2016/07/12 05:47:31
Done.
| |
| 4 | 7 |
| 5 <body> | 8 <body> |
| 6 <div id='e'></div> | 9 <div id='e'></div> |
| 7 </body> | 10 </body> |
| 8 | 11 |
| 9 <script> | 12 <script> |
| 10 var element = document.getElementById('e'); | 13 var element = document.getElementById('e'); |
| 11 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; | 14 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; |
| 12 | 15 |
| 13 test(function() { | 16 test(function() { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 24 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 0); | 27 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 0); |
| 25 animation.currentTime = 1000; | 28 animation.currentTime = 1000; |
| 26 assert_equals(keyframeEffect.getComputedTiming().localTime, 1000); | 29 assert_equals(keyframeEffect.getComputedTiming().localTime, 1000); |
| 27 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 0); | 30 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 0); |
| 28 animation.currentTime = 5000; | 31 animation.currentTime = 5000; |
| 29 assert_equals(keyframeEffect.getComputedTiming().localTime, 5000); | 32 assert_equals(keyframeEffect.getComputedTiming().localTime, 5000); |
| 30 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 2); | 33 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 2); |
| 31 animation.currentTime = 7000; | 34 animation.currentTime = 7000; |
| 32 assert_equals(keyframeEffect.getComputedTiming().localTime, 7000); | 35 assert_equals(keyframeEffect.getComputedTiming().localTime, 7000); |
| 33 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 2); | 36 assert_equals(keyframeEffect.getComputedTiming().currentIteration, 2); |
| 34 }, 'TimedItem.localTime and TimedItem.currentIteration return reasonable values when an keyframeEffect is in effect'); | 37 }, 'ComputedTimingProperties.localTime and ComputedTimingProperties.currentItera tion return reasonable values when an keyframeEffect is in effect'); |
| 35 | 38 |
| 36 test(function() { | 39 test(function() { |
| 37 var animation = element.animate(keyframes); | 40 var animation = element.animate(keyframes); |
| 38 var keyframeEffect = animation.effect; | 41 var keyframeEffect = animation.effect; |
| 39 animation.currentTime = -1; | 42 animation.currentTime = -1; |
| 40 assert_equals(keyframeEffect.getComputedTiming().currentIteration, null); | 43 assert_equals(keyframeEffect.getComputedTiming().currentIteration, null); |
| 41 animation.currentTime = 1; | 44 animation.currentTime = 1; |
| 42 assert_equals(keyframeEffect.getComputedTiming().currentIteration, null); | 45 assert_equals(keyframeEffect.getComputedTiming().currentIteration, null); |
| 43 }, 'TimedItem.currentIteration is null when keyframeEffect is not in effect'); | 46 }, 'ComputedTimingProperties.currentIteration is null when keyframeEffect is not in effect'); |
| 44 | 47 |
| 45 test(function() { | 48 test(function() { |
| 46 var keyframeEffect = new KeyframeEffect(element, keyframes, 2); | 49 var keyframeEffect = new KeyframeEffect(element, keyframes, 2); |
| 47 assert_equals(keyframeEffect.getComputedTiming().endTime, 2); | 50 assert_equals(keyframeEffect.getComputedTiming().endTime, 2); |
| 48 assert_equals(keyframeEffect.getComputedTiming().duration, 2); | 51 assert_equals(keyframeEffect.getComputedTiming().duration, 2); |
| 49 assert_equals(keyframeEffect.getComputedTiming().activeDuration, 2); | 52 assert_equals(keyframeEffect.getComputedTiming().activeDuration, 2); |
| 50 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for a si mple keyframeEffect'); | 53 }, 'ComputedTimingProperties startTime, endTime, duration, activeDuration are se nsible for a simple keyframeEffect'); |
| 51 | 54 |
| 52 test(function() { | 55 test(function() { |
| 53 var keyframeEffect = new KeyframeEffect(element, keyframes, {duration: 3, iter ations: 4, delay: 5}); | 56 var keyframeEffect = new KeyframeEffect(element, keyframes, {duration: 3, iter ations: 4, delay: 5}); |
| 54 assert_equals(keyframeEffect.getComputedTiming().endTime, 17); | 57 assert_equals(keyframeEffect.getComputedTiming().endTime, 17); |
| 55 assert_equals(keyframeEffect.getComputedTiming().duration, 3); | 58 assert_equals(keyframeEffect.getComputedTiming().duration, 3); |
| 56 assert_equals(keyframeEffect.getComputedTiming().activeDuration, 12); | 59 assert_equals(keyframeEffect.getComputedTiming().activeDuration, 12); |
| 57 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for keyf rameEffects with delays and iterations'); | 60 }, 'ComputedTimingProperties startTime, endTime, duration, activeDuration are se nsible for keyframeEffects with delays and iterations'); |
| 58 | 61 |
| 59 test(function() { | 62 test(function() { |
| 60 var keyframeEffect = new KeyframeEffect(element, keyframes, {delay: 1}); | 63 var keyframeEffect = new KeyframeEffect(element, keyframes, {delay: 1}); |
| 61 assert_equals(keyframeEffect.getComputedTiming().duration, 0); | 64 assert_equals(keyframeEffect.getComputedTiming().duration, 0); |
| 62 }, 'TimedItem duration is calculated when no duration is specified'); | 65 }, 'ComputedTimingProperties duration is calculated when no duration is specifie d'); |
| 63 | 66 |
| 64 test(function() { | 67 test(function() { |
| 65 var timing = new KeyframeEffect(element, keyframes).timing; | 68 var timing = new KeyframeEffect(element, keyframes).timing; |
| 66 for (var attr of ['delay', 'endDelay', 'iterationStart', 'playbackRate']) { | 69 for (var attr of ['delay', 'endDelay', 'iterationStart', 'playbackRate']) { |
| 67 assert_throws(new TypeError, function() { timing[attr] = NaN; }, attr); | 70 assert_throws(new TypeError, function() { timing[attr] = NaN; }, attr); |
| 68 assert_throws(new TypeError, function() { timing[attr] = Infinity; }, attr); | 71 assert_throws(new TypeError, function() { timing[attr] = Infinity; }, attr); |
| 69 } | 72 } |
| 70 }, 'Restricted double attributes on the Timing interface throws for non-finite v alues.'); | 73 }, 'Restricted double attributes on the AnimationEffectTiming interface throws f or non-finite values.'); |
| 71 | 74 |
| 72 </script> | 75 </script> |
| OLD | NEW |