OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Tests for phases and states</title> | 3 <title>Tests for phases and states</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#animation-effect-ph
ases-and-states"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#animation-effect-ph
ases-and-states"> |
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> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 { currentTime: 2, phase: 'after' } ] | 66 { currentTime: 2, phase: 'after' } ] |
67 .forEach(function(test) { | 67 .forEach(function(test) { |
68 assert_phase_at_time(animation, test.phase, test.currentTime); | 68 assert_phase_at_time(animation, test.phase, test.currentTime); |
69 }); | 69 }); |
70 }, 'Phase calculation for an animation effect with a positive start delay'); | 70 }, 'Phase calculation for an animation effect with a positive start delay'); |
71 | 71 |
72 test(function(t) { | 72 test(function(t) { |
73 var animation = createDiv(t).animate(null, { duration: 1, delay: -1 }); | 73 var animation = createDiv(t).animate(null, { duration: 1, delay: -1 }); |
74 | 74 |
75 [ { currentTime: -2, phase: 'before' }, | 75 [ { currentTime: -2, phase: 'before' }, |
76 { currentTime: -1, phase: 'before' }, | 76 { currentTime: -1, phase: 'active' }, |
77 { currentTime: 0, phase: 'after' } ] | 77 { currentTime: 0, phase: 'after' } ] |
78 .forEach(function(test) { | 78 .forEach(function(test) { |
79 assert_phase_at_time(animation, test.phase, test.currentTime); | 79 assert_phase_at_time(animation, test.phase, test.currentTime); |
80 }); | 80 }); |
81 }, 'Phase calculation for an animation effect with a negative start delay'); | 81 }, 'Phase calculation for an animation effect with a negative start delay'); |
82 | 82 |
83 test(function(t) { | 83 test(function(t) { |
84 var animation = createDiv(t).animate(null, { duration: 1, endDelay: 1 }); | 84 var animation = createDiv(t).animate(null, { duration: 1, endDelay: 1 }); |
85 | 85 |
86 [ { currentTime: -1, phase: 'before' }, | 86 [ { currentTime: -1, phase: 'before' }, |
(...skipping 27 matching lines...) Expand all Loading... |
114 .forEach(function(test) { | 114 .forEach(function(test) { |
115 assert_phase_at_time(animation, test.phase, test.currentTime); | 115 assert_phase_at_time(animation, test.phase, test.currentTime); |
116 }); | 116 }); |
117 }, 'Phase calculation for an animation effect with a negative end delay equal' | 117 }, 'Phase calculation for an animation effect with a negative end delay equal' |
118 + ' in magnitude to the active duration'); | 118 + ' in magnitude to the active duration'); |
119 | 119 |
120 test(function(t) { | 120 test(function(t) { |
121 var animation = createDiv(t).animate(null, { duration: 1, endDelay: -2 }); | 121 var animation = createDiv(t).animate(null, { duration: 1, endDelay: -2 }); |
122 | 122 |
123 [ { currentTime: -2, phase: 'before' }, | 123 [ { currentTime: -2, phase: 'before' }, |
124 { currentTime: -1, phase: 'before' }, | 124 { currentTime: -1, phase: 'after' } ] |
125 { currentTime: 0, phase: 'after' } ] | |
126 .forEach(function(test) { | 125 .forEach(function(test) { |
127 assert_phase_at_time(animation, test.phase, test.currentTime); | 126 assert_phase_at_time(animation, test.phase, test.currentTime); |
128 }); | 127 }); |
129 }, 'Phase calculation for an animation effect with a negative end delay' | 128 }, 'Phase calculation for an animation effect with a negative end delay' |
130 + ' greater in magnitude than the active duration'); | 129 + ' greater in magnitude than the active duration'); |
131 | 130 |
132 test(function(t) { | 131 test(function(t) { |
133 var animation = createDiv(t).animate(null, { duration: 2, | 132 var animation = createDiv(t).animate(null, { duration: 2, |
134 delay: 1, | 133 delay: 1, |
135 endDelay: -1 }); | 134 endDelay: -1 }); |
136 | 135 |
137 [ { currentTime: 0, phase: 'before' }, | 136 [ { currentTime: 0, phase: 'before' }, |
138 { currentTime: 1, phase: 'active' }, | 137 { currentTime: 1, phase: 'active' }, |
139 { currentTime: 2, phase: 'after' } ] | 138 { currentTime: 2, phase: 'after' } ] |
140 .forEach(function(test) { | 139 .forEach(function(test) { |
141 assert_phase_at_time(animation, test.phase, test.currentTime); | 140 assert_phase_at_time(animation, test.phase, test.currentTime); |
142 }); | 141 }); |
143 }, 'Phase calculation for an animation effect with a positive start delay' | 142 }, 'Phase calculation for an animation effect with a positive start delay' |
144 + ' and a negative end delay lesser in magnitude than the active duration'); | 143 + ' and a negative end delay lesser in magnitude than the active duration'); |
145 | 144 |
146 test(function(t) { | 145 test(function(t) { |
147 var animation = createDiv(t).animate(null, { duration: 1, | 146 var animation = createDiv(t).animate(null, { duration: 1, |
148 delay: -1, | 147 delay: -1, |
149 endDelay: -1 }); | 148 endDelay: -1 }); |
150 | 149 |
151 [ { currentTime: -2, phase: 'before' }, | 150 [ { currentTime: -2, phase: 'before' }, |
152 { currentTime: -1, phase: 'before' }, | 151 { currentTime: -1, phase: 'after' } ] |
153 { currentTime: 0, phase: 'after' } ] | |
154 .forEach(function(test) { | 152 .forEach(function(test) { |
155 assert_phase_at_time(animation, test.phase, test.currentTime); | 153 assert_phase_at_time(animation, test.phase, test.currentTime); |
156 }); | 154 }); |
157 }, 'Phase calculation for an animation effect with a negative start delay' | 155 }, 'Phase calculation for an animation effect with a negative start delay' |
158 + ' and a negative end delay equal in magnitude to the active duration'); | 156 + ' and a negative end delay equal in magnitude to the active duration'); |
159 | 157 |
160 test(function(t) { | 158 test(function(t) { |
161 var animation = createDiv(t).animate(null, { duration: 1, | 159 var animation = createDiv(t).animate(null, { duration: 1, |
162 delay: -1, | 160 delay: -1, |
163 endDelay: -2 }); | 161 endDelay: -2 }); |
164 | 162 |
165 [ { currentTime: -3, phase: 'before' }, | 163 [ { currentTime: -3, phase: 'before' }, |
166 { currentTime: -2, phase: 'before' }, | 164 { currentTime: -2, phase: 'after' } ] |
167 { currentTime: -1, phase: 'before' }, | |
168 { currentTime: 0, phase: 'after' } ] | |
169 .forEach(function(test) { | 165 .forEach(function(test) { |
170 assert_phase_at_time(animation, test.phase, test.currentTime); | 166 assert_phase_at_time(animation, test.phase, test.currentTime); |
171 }); | 167 }); |
172 }, 'Phase calculation for an animation effect with a negative start delay' | 168 }, 'Phase calculation for an animation effect with a negative start delay' |
173 + ' and a negative end delay equal greater in magnitude than the active' | 169 + ' and a negative end delay equal greater in magnitude than the active' |
174 + ' duration'); | 170 + ' duration'); |
175 | 171 |
176 test(function(t) { | 172 test(function(t) { |
177 var animation = createDiv(t).animate(null, 1); | 173 var animation = createDiv(t).animate(null, 1); |
178 animation.playbackRate = -1; | 174 animation.playbackRate = -1; |
179 | 175 |
180 [ { currentTime: -1, phase: 'before' }, | 176 [ { currentTime: -1, phase: 'before' }, |
181 { currentTime: 0, phase: 'before' }, | 177 { currentTime: 0, phase: 'before' }, |
182 { currentTime: 1, phase: 'active' }, | 178 { currentTime: 1, phase: 'active' }, |
183 { currentTime: 2, phase: 'after' } ] | 179 { currentTime: 2, phase: 'after' } ] |
184 .forEach(function(test) { | 180 .forEach(function(test) { |
185 assert_phase_at_time(animation, test.phase, test.currentTime); | 181 assert_phase_at_time(animation, test.phase, test.currentTime); |
186 }); | 182 }); |
187 }, 'Phase calculation for a simple animation effect with negative playback' | 183 }, 'Phase calculation for a simple animation effect with negative playback' |
188 + ' rate'); | 184 + ' rate'); |
189 | 185 |
190 </script> | 186 </script> |
191 </body> | 187 </body> |
OLD | NEW |