| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>progress of KeyframeEffectReadOnly getComputedTiming() tests</title> | 3 <title>Simple iteration progress tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
readonly-getcomputedtiming"> | 4 <link rel="help" |
| 5 <link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.o
rg"> | 5 href="https://w3c.github.io/web-animations/#simple-iteration-progress"> |
| 6 <script src="../../../../resources/testharness.js"></script> | 6 <script src="../../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> | 7 <script src="../../../../../resources/testharnessreport.js"></script> |
| 8 <script src="../testcommon.js"></script> | 8 <script src="../../testcommon.js"></script> |
| 9 <body> | 9 <body> |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 function executeTests(tests, description) { | 14 function executeTests(tests, description) { |
| 15 tests.forEach(function(currentTest) { | 15 tests.forEach(function(currentTest) { |
| 16 var testParams = ''; | 16 var testParams = ''; |
| 17 for (var attr in currentTest.input) { | 17 for (var attr in currentTest.input) { |
| 18 testParams += ' ' + attr + ':' + currentTest.input[attr]; | 18 testParams += ' ' + attr + ':' + currentTest.input[attr]; |
| 19 } | 19 } |
| 20 test(function(t) { | 20 test(function(t) { |
| 21 var div = createDiv(t); | 21 var div = createDiv(t); |
| 22 var anim = div.animate({ opacity: [ 0, 1 ] }, currentTest.input); | 22 var anim = div.animate({ opacity: [ 0, 1 ] }, currentTest.input); |
| 23 assert_equals(anim.effect.getComputedTiming().progress, | 23 assert_equals(anim.effect.getComputedTiming().progress, |
| 24 currentTest.before); | 24 currentTest.before); |
| 25 anim.currentTime = currentTest.input.delay || 0; | 25 anim.currentTime = currentTest.input.delay || 0; |
| 26 assert_equals(anim.effect.getComputedTiming().progress, | 26 assert_equals(anim.effect.getComputedTiming().progress, |
| 27 currentTest.active); | 27 currentTest.active); |
| 28 if (typeof currentTest.after !== 'undefined') { | 28 if (typeof currentTest.after !== 'undefined') { |
| 29 anim.finish(); | 29 anim.finish(); |
| 30 assert_equals(anim.effect.getComputedTiming().progress, | 30 assert_equals(anim.effect.getComputedTiming().progress, |
| 31 currentTest.after); | 31 currentTest.after); |
| 32 } | 32 } |
| 33 }, description + testParams); | 33 }, description + testParams); |
| 34 }); | 34 }); |
| 35 } | 35 } |
| 36 | 36 |
| 37 async_test(function(t) { | |
| 38 var div = createDiv(t); | |
| 39 var anim = div.animate({ opacity: [ 0, 1 ] }, { delay: 1 }); | |
| 40 assert_equals(anim.effect.getComputedTiming().progress, null); | |
| 41 anim.finished.then(t.step_func(function() { | |
| 42 assert_equals(anim.effect.getComputedTiming().progress, null); | |
| 43 t.done(); | |
| 44 })); | |
| 45 }, 'Test progress during before and after phase when fill is none'); | |
| 46 | |
| 47 var gTests_zero_iterations = [ | 37 var gTests_zero_iterations = [ |
| 48 { | 38 { |
| 49 input: { iterations: 0, | 39 input: { iterations: 0, |
| 50 iterationStart: 0, | 40 iterationStart: 0, |
| 51 duration: 0, | 41 duration: 0, |
| 52 delay: 1, | 42 delay: 1, |
| 53 fill: 'both' }, | 43 fill: 'both' }, |
| 54 before: 0, | 44 before: 0, |
| 55 active: 0, | 45 active: 0, |
| 56 after: 0 | 46 after: 0 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 426 } |
| 437 ]; | 427 ]; |
| 438 | 428 |
| 439 executeTests(gTests_zero_iterations, "Test zero iterations:"); | 429 executeTests(gTests_zero_iterations, "Test zero iterations:"); |
| 440 executeTests(gTests_integer_iterations, "Test integer iterations:"); | 430 executeTests(gTests_integer_iterations, "Test integer iterations:"); |
| 441 executeTests(gTests_fractional_iterations, "Test fractional iterations:"); | 431 executeTests(gTests_fractional_iterations, "Test fractional iterations:"); |
| 442 executeTests(gTests_infinity_iterations, "Test infinity iterations:"); | 432 executeTests(gTests_infinity_iterations, "Test infinity iterations:"); |
| 443 | 433 |
| 444 </script> | 434 </script> |
| 445 </body> | 435 </body> |
| OLD | NEW |