Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script src="../resources/testharness.js"></script> | |
|
suzyh_UTC10 (ex-contributor)
2016/07/25 00:51:09
Are we intending to upstream this one?
alancutter (OOO until 2018)
2016/07/25 01:44:32
Yes.
suzyh_UTC10 (ex-contributor)
2016/07/25 01:52:12
In that case, please add the usual meta/header inf
alancutter (OOO until 2018)
2016/07/25 04:46:48
Done.
| |
| 2 <script src="../resources/testharnessreport.js"></script> | |
| 3 <script src="../imported/wpt/web-animations/testcommon.js"></script> | |
| 4 <body> | |
| 5 <script> | |
| 6 'use strict'; | |
| 7 | |
| 8 var keyframes = {left: ['0px', '1px']}; | |
| 9 | |
| 10 // TODO(alancutter): Implement animation.effect.getComputedTiming().progress to | |
|
suzyh_UTC10 (ex-contributor)
2016/07/25 00:51:09
Don't we have this now?
alancutter (OOO until 2018)
2016/07/25 01:44:32
Using it now.
| |
| 11 // query the timing model more directly and avoid having to read getComputedStyl e(). | |
| 12 function animationProgress(element) { | |
| 13 return parseFloat(getComputedStyle(element).left); | |
| 14 } | |
| 15 | |
| 16 test(function(t) { | |
| 17 var element = createDiv(t); | |
| 18 var animation = element.animate(keyframes, { | |
| 19 fill: 'forwards', | |
| 20 duration: 1, | |
| 21 endDelay: -1, | |
| 22 }); | |
| 23 animation.currentTime = 10; | |
| 24 assert_equals(animationProgress(element), 0, | |
| 25 'Progress should be zero since we clip to the start of the animation'); | |
| 26 }, 'Negative end delay clipping into the start of the animation'); | |
| 27 | |
| 28 test(function(t) { | |
| 29 var element = createDiv(t); | |
| 30 var animation = element.animate(keyframes, { | |
| 31 fill: 'forwards', | |
| 32 duration: 1, | |
| 33 iterations: 2, | |
| 34 endDelay: -1, | |
| 35 }); | |
| 36 animation.currentTime = 10; | |
| 37 assert_equals(animationProgress(element), 1, | |
| 38 'Progress should be 1 since we clip to the end of the first iteration ' + | |
| 39 'and the second iteration does not have a chance to start'); | |
| 40 }, 'Negative end delay clipping to the end of the the first iteration'); | |
| 41 | |
| 42 test(function(t) { | |
| 43 var element = createDiv(t); | |
| 44 var animation = element.animate(keyframes, { | |
| 45 fill: 'forwards', | |
| 46 duration: 1, | |
| 47 iterations: 2, | |
| 48 endDelay: -0.75, | |
| 49 }); | |
| 50 animation.currentTime = 10; | |
| 51 assert_equals(animationProgress(element), 0.25, | |
| 52 'Progress should be 0.25 since we clip part way through the second iterati on'); | |
| 53 }, 'Negative end delay clipping part way into the second iteration'); | |
| 54 | |
| 55 test(function(t) { | |
| 56 var element = createDiv(t); | |
| 57 var animation = element.animate(keyframes, { | |
| 58 fill: 'forwards', | |
| 59 duration: 1, | |
| 60 iterations: 0, | |
| 61 endDelay: -1, | |
| 62 }); | |
| 63 animation.currentTime = 10; | |
| 64 assert_equals(animationProgress(element), 0, | |
| 65 'Progress should be 0 since there are no iterations to make progress in'); | |
| 66 }, 'Negative end delay clipping into zero iterations'); | |
| 67 | |
| 68 </script> | |
| 69 </body> | |
| OLD | NEW |