Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/web-animations/timing-model/animation-effects/active-time.html

Issue 2212873003: W3C auto test importer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title>Active time tests</title> 3 <title>Active time tests</title>
4 <link rel="help" href="https://w3c.github.io/web-animations/#active-time"> 4 <link rel="help" href="https://w3c.github.io/web-animations/#calculating-the-act ive-time">
5 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testharnessreport.js"></script>
7 <script src="../../testcommon.js"></script> 7 <script src="../../testcommon.js"></script>
8 <body> 8 <body>
9 <div id="log"></div> 9 <div id="log"></div>
10 <script> 10 <script>
11 'use strict'; 11 'use strict';
12 12
13 async_test(function(t) { 13 test(function(t) {
14 var div = createDiv(t); 14 var tests = [ { fill: 'none', progress: null },
15 var anim = div.animate({ opacity: [ 0, 1 ] }, { delay: 1 }); 15 { fill: 'backwards', progress: 0 },
16 { fill: 'forwards', progress: null },
17 { fill: 'both', progress: 0 } ];
18 tests.forEach(function(test) {
19 var anim = createDiv(t).animate(null, { delay: 1, fill: test.fill });
20 assert_equals(anim.effect.getComputedTiming().progress, test.progress,
21 'Progress in before phase when using \'' + test.fill
22 + '\' fill');
23 });
24 }, 'Active time in before phase');
25
26 test(function(t) {
27 var anim = createDiv(t).animate(null, 1000);
28 anim.currentTime = 500;
29 assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
30 }, 'Active time in active phase and no start delay is the local time');
31
32 test(function(t) {
33 var anim = createDiv(t).animate(null, { duration: 1000, delay: 500 });
34 anim.currentTime = 1000;
35 assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
36 }, 'Active time in active phase and positive start delay is the local time'
37 + ' minus the start delay');
38
39 test(function(t) {
40 var anim = createDiv(t).animate(null, { duration: 1000, delay: -500 });
41 assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
42 }, 'Active time in active phase and negative start delay is the local time'
43 + ' minus the start delay');
44
45 test(function(t) {
46 var anim = createDiv(t).animate(null);
16 assert_equals(anim.effect.getComputedTiming().progress, null); 47 assert_equals(anim.effect.getComputedTiming().progress, null);
17 anim.finished.then(t.step_func(function() { 48 }, 'Active time in after phase with no fill is unresolved');
18 assert_equals(anim.effect.getComputedTiming().progress, null); 49
19 t.done(); 50 test(function(t) {
20 })); 51 var anim = createDiv(t).animate(null, { fill: 'backwards' });
21 }, 'Test progress during before and after phase when fill is none'); 52 assert_equals(anim.effect.getComputedTiming().progress, null);
53 }, 'Active time in after phase with backwards-only fill is unresolved');
54
55 test(function(t) {
56 var anim = createDiv(t).animate(null, { duration: 1000,
57 iterations: 2.3,
58 delay: 500, // Should have no effect
59 fill: 'forwards' });
60 anim.finish();
61 assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
62 assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
63 }, 'Active time in after phase with forwards fill is the active duration');
64
65 test(function(t) {
66 var anim = createDiv(t).animate(null, { duration: 0,
67 iterations: Infinity,
68 fill: 'forwards' });
69 anim.finish();
70 assert_equals(anim.effect.getComputedTiming().currentIteration, Infinity);
71 assert_equals(anim.effect.getComputedTiming().progress, 1);
72 }, 'Active time in after phase with forwards fill, zero-duration, and '
73 + ' infinite iteration count is the active duration');
74
75 test(function(t) {
76 var anim = createDiv(t).animate(null, { duration: 1000,
77 iterations: 2.3,
78 delay: 500,
79 endDelay: 4000,
80 fill: 'forwards' });
81 anim.finish();
82 assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
83 assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
84 }, 'Active time in after phase with forwards fill and positive end delay'
85 + ' is the active duration');
86
87 test(function(t) {
88 var anim = createDiv(t).animate(null, { duration: 1000,
89 iterations: 2.3,
90 delay: 500,
91 endDelay: -800,
92 fill: 'forwards' });
93 anim.finish();
94 assert_equals(anim.effect.getComputedTiming().currentIteration, 1);
95 assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
96 }, 'Active time in after phase with forwards fill and negative end delay'
97 + ' is the active duration + end delay');
98
99 test(function(t) {
100 var anim = createDiv(t).animate(null, { duration: 1000,
101 iterations: 2.3,
102 delay: 500,
103 endDelay: -3000,
104 fill: 'forwards' });
105 anim.finish();
106 assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
107 assert_equals(anim.effect.getComputedTiming().progress, 0);
108 }, 'Active time in after phase with forwards fill and negative end delay'
109 + ' greater in magnitude than the active duration is zero');
110
111 test(function(t) {
112 var anim = createDiv(t).animate(null, { duration: 1000,
113 iterations: 2.3,
114 delay: 500,
115 endDelay: -4000,
116 fill: 'forwards' });
117 anim.finish();
118 assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
119 assert_equals(anim.effect.getComputedTiming().progress, 0);
120 }, 'Active time in after phase with forwards fill and negative end delay'
121 + ' greater in magnitude than the sum of the active duration and start delay'
122 + ' is zero');
123
124 test(function(t) {
125 var anim = createDiv(t).animate(null, { duration: 1000,
126 iterations: 2.3,
127 delay: 500,
128 fill: 'both' });
129 anim.finish();
130 assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
131 assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
132 }, 'Active time in after phase with \'both\' fill is the active duration');
133
134 test(function(t) {
135 // Create an effect with a non-zero duration so we ensure we're not just
136 // testing the after-phase behavior.
137 var effect = new KeyframeEffect(null, null, 1);
138 assert_equals(effect.getComputedTiming().progress, null);
139 }, 'Active time when the local time is unresolved, is unresolved');
22 140
23 </script> 141 </script>
24 </body> 142 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698