OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Tests for effect clipping via negative end delay</title> |
| 4 <link rel="help" href="http://w3c.github.io/web-animations/#calculating-the-acti
ve-time"> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="../imported/wpt/web-animations/testcommon.js"></script> |
| 8 <body> |
| 9 <script> |
| 10 'use strict'; |
| 11 |
| 12 test(function(t) { |
| 13 var animation = createDiv(t).animate(null, { |
| 14 fill: 'forwards', |
| 15 duration: 1, |
| 16 endDelay: -1, |
| 17 }); |
| 18 animation.currentTime = 10; |
| 19 assert_equals(animation.effect.getComputedTiming().progress, 0, |
| 20 'Progress should be zero since we clip to the start of the animation'); |
| 21 }, 'Negative end delay clipping into the start of the animation'); |
| 22 |
| 23 test(function(t) { |
| 24 var animation = createDiv(t).animate(null, { |
| 25 fill: 'forwards', |
| 26 duration: 1, |
| 27 iterations: 2, |
| 28 endDelay: -1, |
| 29 }); |
| 30 animation.currentTime = 10; |
| 31 assert_equals(animation.effect.getComputedTiming().progress, 1, |
| 32 'Progress should be 1 since we clip to the end of the first iteration ' + |
| 33 'and the second iteration does not have a chance to start'); |
| 34 }, 'Negative end delay clipping to the end of the the first iteration'); |
| 35 |
| 36 test(function(t) { |
| 37 var animation = createDiv(t).animate(null, { |
| 38 fill: 'forwards', |
| 39 duration: 1, |
| 40 iterations: 2, |
| 41 endDelay: -0.75, |
| 42 }); |
| 43 animation.currentTime = 10; |
| 44 assert_equals(animation.effect.getComputedTiming().progress, 0.25, |
| 45 'Progress should be 0.25 since we clip part way through the second iterati
on'); |
| 46 }, 'Negative end delay clipping part way into the second iteration'); |
| 47 |
| 48 test(function(t) { |
| 49 var animation = createDiv(t).animate(null, { |
| 50 fill: 'forwards', |
| 51 duration: 1, |
| 52 iterations: 0, |
| 53 endDelay: -1, |
| 54 }); |
| 55 animation.currentTime = 10; |
| 56 assert_equals(animation.effect.getComputedTiming().progress, 0, |
| 57 'Progress should be 0 since there are no iterations to make progress in'); |
| 58 }, 'Negative end delay clipping into zero iterations'); |
| 59 |
| 60 </script> |
| 61 </body> |
OLD | NEW |