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

Side by Side Diff: third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html

Issue 2145453002: Animations: Fix play state changes test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix play state changes test Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Test play state changes for animations with a negative playback rate</tit le>
4 <link rel="help" href="http://w3c.github.io/web-animations/#play-state">
5 <script src="../imported/wpt/web-animations/testcommon.js"></script>
2 <script src="../resources/testharness.js"></script> 6 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 7 <script src="../resources/testharnessreport.js"></script>
4 8
5 <script> 9 <script>
6 var duration = 100000; 10 var duration = 100000;
7 11
8 function assert_unresolved(value) { 12 function assert_unresolved(value) {
9 assert_equals(value, null); 13 assert_equals(value, null);
10 } 14 }
11 15
12 function idleAnimation() { 16 function idleAnimation() {
13 var animation = document.documentElement.animate([], duration); 17 var animation = document.documentElement.animate([], duration);
14 animation.reverse(); 18 animation.reverse();
15 animation.cancel(); 19 animation.cancel();
16 return animation; 20 return animation;
17 } 21 }
18 22
19 function runningAnimation() { 23 function runningAnimation() {
20 var animation = idleAnimation(); 24 var animation = idleAnimation();
21 animation.play(); 25 animation.play();
22 animation.startTime = document.timeline.currentTime + duration / 2; 26 animation.startTime = document.timeline.currentTime + duration / 2;
23 return animation; 27 return animation;
24 } 28 }
25 29
26 function pendingStartTimeAnimation() { 30 function pendingAnimation() {
27 var animation = idleAnimation(); 31 var animation = idleAnimation();
28 animation.play(); 32 animation.play();
29 return animation; 33 return animation;
30 } 34 }
31 35
32 function pausedAnimation() { 36 function pausedAnimation() {
33 var animation = idleAnimation(); 37 var animation = idleAnimation();
34 animation.pause(); 38 animation.pause();
35 animation.currentTime = duration; 39 animation.currentTime = duration;
36 return animation; 40 return animation;
37 } 41 }
38 42
39 function finishedAnimation() { 43 function finishedAnimation() {
40 var animation = idleAnimation(); 44 var animation = idleAnimation();
41 animation.play(); 45 animation.play();
42 animation.finish(); 46 animation.finish();
43 return animation; 47 return animation;
44 } 48 }
45 49
46 test(function() { 50 test(function() {
47 var animation = idleAnimation(); 51 var animation = idleAnimation();
48 assert_unresolved(animation.startTime); 52 assert_unresolved(animation.startTime);
49 assert_unresolved(animation.currentTime); 53 assert_unresolved(animation.currentTime);
50 assert_equals(animation.playState, 'idle'); 54 assert_equals(animation.playState, 'idle');
51 }, "idle"); 55 }, "Play state is idle after cancelling a reversed animation");
52 56
53 test(function() { 57 test(function() {
54 var animation = pendingStartTimeAnimation(); 58 var animation = pendingAnimation();
55 assert_unresolved(animation.startTime); 59 assert_unresolved(animation.startTime);
56 assert_equals(animation.currentTime, duration); 60 assert_equals(animation.currentTime, duration);
57 assert_equals(animation.playState, 'pending'); 61 assert_equals(animation.playState, 'pending');
58 }, "pending startTime"); 62 }, "Play state is pending after playing a cancelled reversed animation");
59 63
60 test(function() { 64 test(function() {
61 var animation = runningAnimation(); 65 var animation = runningAnimation();
62 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 66 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
63 assert_approx_equals(animation.currentTime, duration / 2, 0.000001); 67 assert_times_equal(animation.currentTime, duration / 2);
64 assert_equals(animation.playState, 'running'); 68 assert_equals(animation.playState, 'running');
65 }, "running"); 69 }, "Play state is running after playing and setting start time of a cancelled re versed animation");
66 70
67 test(function() { 71 test(function() {
68 var animation = pausedAnimation(); 72 var animation = pausedAnimation();
69 assert_unresolved(animation.startTime); 73 assert_unresolved(animation.startTime);
70 assert_equals(animation.currentTime, duration); 74 assert_equals(animation.currentTime, duration);
71 assert_equals(animation.playState, 'paused'); 75 assert_equals(animation.playState, 'paused');
72 }, "paused"); 76 }, "Play state is paused after pausing and setting current time of a cancelled r eversed animation");
73 77
74 test(function() { 78 test(function() {
75 var animation = finishedAnimation(); 79 var animation = finishedAnimation();
76 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 80 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime));
77 assert_equals(animation.currentTime, 0); 81 assert_equals(animation.currentTime, 0);
78 assert_equals(animation.playState, 'finished'); 82 assert_equals(animation.playState, 'finished');
79 }, "finished"); 83 }, "Play state is finished after playing and finishing a cancelled reversed anim ation");
80 84
81 test(function() { 85 test(function() {
82 var animation = idleAnimation(); 86 var animation = idleAnimation();
83 animation.play(); 87 animation.play();
84 assert_unresolved(animation.startTime); 88 assert_unresolved(animation.startTime);
85 assert_equals(animation.currentTime, duration); 89 assert_equals(animation.currentTime, duration);
86 assert_equals(animation.playState, 'pending'); 90 assert_equals(animation.playState, 'pending');
87 }, "idle -> play()"); 91 }, "Calling play() on an idle animation");
88 92
89 test(function() { 93 test(function() {
90 var animation = idleAnimation(); 94 var animation = idleAnimation();
91 animation.pause(); 95 animation.pause();
92 assert_unresolved(animation.startTime); 96 assert_unresolved(animation.startTime);
93 assert_equals(animation.currentTime, duration); 97 assert_equals(animation.currentTime, duration);
94 assert_equals(animation.playState, 'pending'); 98 assert_equals(animation.playState, 'pending');
95 }, "idle -> pause()"); 99 }, "Calling pause() on an idle animation");
96 100
97 test(function() { 101 test(function() {
98 var animation = idleAnimation(); 102 var animation = idleAnimation();
99 animation.cancel(); 103 animation.cancel();
100 assert_unresolved(animation.startTime); 104 assert_unresolved(animation.startTime);
101 assert_unresolved(animation.currentTime); 105 assert_unresolved(animation.currentTime);
102 assert_equals(animation.playState, 'idle'); 106 assert_equals(animation.playState, 'idle');
103 }, "idle -> cancel()"); 107 }, "Calling cancel() on an idle animation");
104 108
105 test(function() { 109 test(function() {
106 var animation = idleAnimation(); 110 var animation = idleAnimation();
107 animation.finish(); 111 animation.finish();
108 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 112 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime));
109 assert_equals(animation.currentTime, 0); 113 assert_equals(animation.currentTime, 0);
110 assert_equals(animation.playState, 'finished'); 114 assert_equals(animation.playState, 'finished');
111 }, "idle -> finish()"); 115 }, "Calling finish() on an idle animation");
112 116
113 test(function() { 117 test(function() {
114 var animation = idleAnimation(); 118 var animation = idleAnimation();
115 animation.reverse(); 119 animation.reverse();
116 assert_unresolved(animation.startTime); 120 assert_unresolved(animation.startTime);
117 assert_equals(animation.currentTime, 0); 121 assert_equals(animation.currentTime, 0);
118 assert_equals(animation.playState, 'pending'); 122 assert_equals(animation.playState, 'pending');
119 }, "idle -> reverse()"); 123 }, "Calling reverse() on an idle animation");
120 124
121 test(function() { 125 test(function() {
122 var animation = idleAnimation(); 126 var animation = idleAnimation();
123 animation.currentTime = 1000; 127 animation.currentTime = 1000;
124 assert_unresolved(animation.startTime); 128 assert_unresolved(animation.startTime);
125 assert_equals(animation.currentTime, 1000); 129 assert_equals(animation.currentTime, 1000);
126 assert_equals(animation.playState, 'paused'); 130 assert_equals(animation.playState, 'paused');
127 }, "idle -> set currentTime"); 131 }, "Setting currentTime on an idle animation");
128 132
129 test(function() { 133 test(function() {
130 var animation = idleAnimation(); 134 var animation = idleAnimation();
131 animation.startTime = document.timeline.currentTime + 1000; 135 animation.startTime = document.timeline.currentTime + 1000;
132 assert_equals(animation.startTime, document.timeline.currentTime + 1000); 136 assert_times_equal(animation.startTime, document.timeline.currentTime + 1000);
133 assert_equals(animation.currentTime, 1000); 137 assert_times_equal(animation.currentTime, 1000);
134 assert_equals(animation.playState, 'running'); 138 assert_equals(animation.playState, 'running');
135 }, "idle -> set startTime"); 139 }, "Setting startTime on an idle animation");
136 140
137 test(function() { 141 test(function() {
138 var animation = pendingStartTimeAnimation(); 142 var animation = pendingAnimation();
139 animation.play(); 143 animation.play();
140 assert_unresolved(animation.startTime); 144 assert_unresolved(animation.startTime);
141 assert_equals(animation.currentTime, duration); 145 assert_equals(animation.currentTime, duration);
142 assert_equals(animation.playState, 'pending'); 146 assert_equals(animation.playState, 'pending');
143 }, "pending startTime -> play()"); 147 }, "Calling play() on a pending animation");
144 148
145 test(function() { 149 test(function() {
146 var animation = pendingStartTimeAnimation(); 150 var animation = pendingAnimation();
147 animation.pause(); 151 animation.pause();
148 assert_unresolved(animation.startTime); 152 assert_unresolved(animation.startTime);
149 assert_equals(animation.currentTime, duration); 153 assert_equals(animation.currentTime, duration);
150 assert_equals(animation.playState, 'pending'); 154 assert_equals(animation.playState, 'pending');
151 }, "pending startTime -> pause()"); 155 }, "Calling pause() on a pending animation");
152 156
153 test(function() { 157 test(function() {
154 var animation = pendingStartTimeAnimation(); 158 var animation = pendingAnimation();
155 animation.cancel(); 159 animation.cancel();
156 assert_unresolved(animation.startTime); 160 assert_unresolved(animation.startTime);
157 assert_unresolved(animation.currentTime); 161 assert_unresolved(animation.currentTime);
158 assert_equals(animation.playState, 'idle'); 162 assert_equals(animation.playState, 'idle');
159 }, "pending startTime -> cancel()"); 163 }, "Calling cancel() on a pending animation");
160 164
161 test(function() { 165 test(function() {
162 var animation = pendingStartTimeAnimation(); 166 var animation = pendingAnimation();
163 animation.finish(); 167 animation.finish();
164 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 168 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
165 assert_equals(animation.currentTime, 0); 169 assert_equals(animation.currentTime, 0);
166 assert_equals(animation.playState, 'finished'); 170 assert_equals(animation.playState, 'finished');
167 }, "pending startTime -> finish()"); 171 }, "Calling finish() on a pending animation");
168 172
169 test(function() { 173 test(function() {
170 var animation = pendingStartTimeAnimation(); 174 var animation = pendingAnimation();
171 animation.reverse(); 175 animation.reverse();
172 assert_unresolved(animation.startTime); 176 assert_unresolved(animation.startTime);
173 assert_equals(animation.currentTime, 0); 177 assert_equals(animation.currentTime, 0);
174 assert_equals(animation.playState, 'pending'); 178 assert_equals(animation.playState, 'pending');
175 }, "pending startTime -> reverse()"); 179 }, "Calling reverse() on a pending animation");
176 180
177 test(function() { 181 test(function() {
178 var animation = pendingStartTimeAnimation(); 182 var animation = pendingAnimation();
179 animation.currentTime = 1000; 183 animation.currentTime = 1000;
180 assert_unresolved(animation.startTime); 184 assert_unresolved(animation.startTime);
181 assert_equals(animation.currentTime, 1000); 185 assert_equals(animation.currentTime, 1000);
182 assert_equals(animation.playState, 'pending'); 186 assert_equals(animation.playState, 'pending');
183 }, "pending startTime -> set currentTime"); 187 }, "Setting currentTime on a pending animation");
184 188
185 test(function() { 189 test(function() {
186 var animation = pendingStartTimeAnimation(); 190 var animation = pendingAnimation();
187 animation.startTime = document.timeline.currentTime + 1000; 191 animation.startTime = document.timeline.currentTime + 1000;
188 assert_equals(animation.startTime, document.timeline.currentTime + 1000); 192 assert_times_equal(animation.startTime, document.timeline.currentTime + 1000);
189 assert_equals(animation.currentTime, 1000); 193 assert_times_equal(animation.currentTime, 1000);
190 assert_equals(animation.playState, 'running'); 194 assert_equals(animation.playState, 'running');
191 }, "pending startTime -> set startTime"); 195 }, "Setting startTime on a pending animation");
192 196
193 test(function() { 197 test(function() {
194 var animation = runningAnimation(); 198 var animation = runningAnimation();
195 var startTime = animation.startTime; 199 var startTime = animation.startTime;
196 var currentTime = animation.currentTime; 200 var currentTime = animation.currentTime;
197 animation.play(); 201 animation.play();
198 assert_equals(animation.startTime, startTime); 202 assert_equals(animation.startTime, startTime);
199 assert_equals(animation.currentTime, currentTime); 203 assert_equals(animation.currentTime, currentTime);
200 assert_equals(animation.playState, 'running'); 204 assert_equals(animation.playState, 'running');
201 }, "running -> play()"); 205 }, "Calling play() on a running animation");
202 206
203 test(function() { 207 test(function() {
204 var animation = runningAnimation(); 208 var animation = runningAnimation();
205 animation.pause(); 209 animation.pause();
206 assert_unresolved(animation.startTime); 210 assert_unresolved(animation.startTime);
207 assert_approx_equals(animation.currentTime, duration / 2, 0.000001); 211 assert_times_equal(animation.currentTime, duration / 2);
208 assert_equals(animation.playState, 'pending'); 212 assert_equals(animation.playState, 'pending');
209 }, "running -> pause()"); 213 }, "Calling pause() on a running animation");
210 214
211 test(function() { 215 test(function() {
212 var animation = runningAnimation(); 216 var animation = runningAnimation();
213 animation.cancel(); 217 animation.cancel();
214 assert_unresolved(animation.startTime); 218 assert_unresolved(animation.startTime);
215 assert_unresolved(animation.currentTime); 219 assert_unresolved(animation.currentTime);
216 assert_equals(animation.playState, 'idle'); 220 assert_equals(animation.playState, 'idle');
217 }, "running -> cancel()"); 221 }, "Calling cancel() on a running animation");
218 222
219 test(function() { 223 test(function() {
220 var animation = runningAnimation(); 224 var animation = runningAnimation();
221 animation.finish(); 225 animation.finish();
222 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 226 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
223 assert_equals(animation.currentTime, 0); 227 assert_equals(animation.currentTime, 0);
224 assert_equals(animation.playState, 'finished'); 228 assert_equals(animation.playState, 'finished');
225 }, "running -> finish()"); 229 }, "Calling finish() on a running animation");
226 230
227 test(function() { 231 test(function() {
228 var animation = runningAnimation(); 232 var animation = runningAnimation();
229 animation.reverse(); 233 animation.reverse();
230 assert_unresolved(animation.startTime); 234 assert_unresolved(animation.startTime);
231 assert_approx_equals(animation.currentTime, duration / 2, 0.000001); 235 assert_times_equal(animation.currentTime, duration / 2);
232 assert_equals(animation.playState, 'pending'); 236 assert_equals(animation.playState, 'pending');
233 }, "running -> reverse()"); 237 }, "Calling reverse() on a running animation");
234 238
235 test(function() { 239 test(function() {
236 var animation = runningAnimation(); 240 var animation = runningAnimation();
237 animation.currentTime = 1000; 241 animation.currentTime = 1000;
238 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 242 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
239 assert_equals(animation.currentTime, 1000); 243 assert_equals(animation.currentTime, 1000);
240 assert_equals(animation.playState, 'running'); 244 assert_equals(animation.playState, 'running');
241 }, "running -> set currentTime"); 245 }, "Setting currentTime on a running animation");
242 246
243 test(function() { 247 test(function() {
244 var animation = runningAnimation(); 248 var animation = runningAnimation();
245 animation.startTime = document.timeline.currentTime + 1000; 249 animation.startTime = document.timeline.currentTime + 1000;
246 assert_equals(animation.startTime, document.timeline.currentTime + 1000); 250 assert_times_equal(animation.startTime, document.timeline.currentTime + 1000);
247 assert_equals(animation.currentTime, 1000); 251 assert_times_equal(animation.currentTime, 1000);
248 assert_equals(animation.playState, 'running'); 252 assert_equals(animation.playState, 'running');
249 }, "running -> set startTime"); 253 }, "Setting startTime on a running animation");
250 254
251 test(function() { 255 test(function() {
252 var animation = pausedAnimation(); 256 var animation = pausedAnimation();
253 animation.play(); 257 animation.play();
254 assert_unresolved(animation.startTime); 258 assert_unresolved(animation.startTime);
255 assert_equals(animation.currentTime, duration); 259 assert_equals(animation.currentTime, duration);
256 assert_equals(animation.playState, 'pending'); 260 assert_equals(animation.playState, 'pending');
257 }, "paused -> play()"); 261 }, "Calling play() on a paused animation");
258 262
259 test(function() { 263 test(function() {
260 var animation = pausedAnimation(); 264 var animation = pausedAnimation();
261 animation.pause(); 265 animation.pause();
262 assert_unresolved(animation.startTime); 266 assert_unresolved(animation.startTime);
263 assert_equals(animation.currentTime, duration); 267 assert_equals(animation.currentTime, duration);
264 assert_equals(animation.playState, 'paused'); 268 assert_equals(animation.playState, 'paused');
265 }, "paused -> pause()"); 269 }, "Calling pause() on a paused animation");
266 270
267 test(function() { 271 test(function() {
268 var animation = pausedAnimation(); 272 var animation = pausedAnimation();
269 animation.cancel(); 273 animation.cancel();
270 assert_unresolved(animation.startTime); 274 assert_unresolved(animation.startTime);
271 assert_unresolved(animation.currentTime); 275 assert_unresolved(animation.currentTime);
272 assert_equals(animation.playState, 'idle'); 276 assert_equals(animation.playState, 'idle');
273 }, "paused -> cancel()"); 277 }, "Calling cancel() on a paused animation");
274 278
275 test(function() { 279 test(function() {
276 var animation = pausedAnimation(); 280 var animation = pausedAnimation();
277 animation.finish(); 281 animation.finish();
278 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 282 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
279 assert_equals(animation.currentTime, 0); 283 assert_equals(animation.currentTime, 0);
280 assert_equals(animation.playState, 'finished'); 284 assert_equals(animation.playState, 'finished');
281 }, "paused -> finish()"); 285 }, "Calling finish() on a paused animation");
282 286
283 test(function() { 287 test(function() {
284 var animation = pausedAnimation(); 288 var animation = pausedAnimation();
285 animation.reverse(); 289 animation.reverse();
286 assert_unresolved(animation.startTime); 290 assert_unresolved(animation.startTime);
287 assert_equals(animation.currentTime, 0); 291 assert_equals(animation.currentTime, 0);
288 assert_equals(animation.playState, 'pending'); 292 assert_equals(animation.playState, 'pending');
289 }, "paused -> reverse()"); 293 }, "Calling reverse() on a paused animation");
290 294
291 test(function() { 295 test(function() {
292 var animation = pausedAnimation(); 296 var animation = pausedAnimation();
293 animation.currentTime = 1000; 297 animation.currentTime = 1000;
294 assert_unresolved(animation.startTime); 298 assert_unresolved(animation.startTime);
295 assert_equals(animation.currentTime, 1000); 299 assert_equals(animation.currentTime, 1000);
296 assert_equals(animation.playState, 'paused'); 300 assert_equals(animation.playState, 'paused');
297 }, "paused -> set currentTime"); 301 }, "Setting currentTime on a paused animation");
298 302
299 test(function() { 303 test(function() {
300 var animation = pausedAnimation(); 304 var animation = pausedAnimation();
301 animation.startTime = document.timeline.currentTime + 1000; 305 animation.startTime = document.timeline.currentTime + 1000;
302 assert_equals(animation.startTime, document.timeline.currentTime + 1000); 306 assert_times_equal(animation.startTime, document.timeline.currentTime + 1000);
303 assert_equals(animation.currentTime, 1000); 307 assert_times_equal(animation.currentTime, 1000);
304 assert_equals(animation.playState, 'running'); 308 assert_equals(animation.playState, 'running');
305 }, "paused -> set startTime"); 309 }, "Setting startTime on a paused animation");
306 310
307 test(function() { 311 test(function() {
308 var animation = finishedAnimation(); 312 var animation = finishedAnimation();
309 animation.play(); 313 animation.play();
310 assert_unresolved(animation.startTime); 314 assert_unresolved(animation.startTime);
311 assert_equals(animation.currentTime, duration); 315 assert_equals(animation.currentTime, duration);
312 assert_equals(animation.playState, 'pending'); 316 assert_equals(animation.playState, 'pending');
313 }, "finished -> play()"); 317 }, "Calling play() on a finished animation");
314 318
315 test(function() { 319 test(function() {
316 var animation = finishedAnimation(); 320 var animation = finishedAnimation();
317 animation.pause(); 321 animation.pause();
318 assert_unresolved(animation.startTime); 322 assert_unresolved(animation.startTime);
319 assert_equals(animation.currentTime, 0); 323 assert_equals(animation.currentTime, 0);
320 assert_equals(animation.playState, 'pending'); 324 assert_equals(animation.playState, 'pending');
321 }, "finished -> pause()"); 325 }, "Calling pause() on a finished animation");
322 326
323 test(function() { 327 test(function() {
324 var animation = finishedAnimation(); 328 var animation = finishedAnimation();
325 animation.cancel(); 329 animation.cancel();
326 assert_unresolved(animation.startTime); 330 assert_unresolved(animation.startTime);
327 assert_unresolved(animation.currentTime); 331 assert_unresolved(animation.currentTime);
328 assert_equals(animation.playState, 'idle'); 332 assert_equals(animation.playState, 'idle');
329 }, "finished -> cancel()"); 333 }, "Calling cancel() on a finished animation");
330 334
331 test(function() { 335 test(function() {
332 var animation = finishedAnimation(); 336 var animation = finishedAnimation();
333 animation.finish(); 337 animation.finish();
334 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 338 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
335 assert_equals(animation.currentTime, 0); 339 assert_equals(animation.currentTime, 0);
336 assert_equals(animation.playState, 'finished'); 340 assert_equals(animation.playState, 'finished');
337 }, "finished -> finish()"); 341 }, "Calling finish() on a finished animation");
338 342
339 test(function() { 343 test(function() {
340 var animation = finishedAnimation(); 344 var animation = finishedAnimation();
341 animation.reverse(); 345 animation.reverse();
342 assert_unresolved(animation.startTime); 346 assert_unresolved(animation.startTime);
343 assert_equals(animation.currentTime, 0); 347 assert_equals(animation.currentTime, 0);
344 assert_equals(animation.playState, 'pending'); 348 assert_equals(animation.playState, 'pending');
345 }, "finished -> reverse()"); 349 }, "Calling reverse() on a finished animation");
346 350
347 test(function() { 351 test(function() {
348 var animation = finishedAnimation(); 352 var animation = finishedAnimation();
349 animation.currentTime = 1000; 353 animation.currentTime = 1000;
350 assert_equals(animation.startTime, document.timeline.currentTime - (animation. playbackRate * animation.currentTime)); 354 assert_times_equal(animation.startTime, document.timeline.currentTime - (anima tion.playbackRate * animation.currentTime));
351 assert_equals(animation.currentTime, 1000); 355 assert_equals(animation.currentTime, 1000);
352 assert_equals(animation.playState, 'running'); 356 assert_equals(animation.playState, 'running');
353 }, "finished -> set currentTime"); 357 }, "Setting currentTime on a finished animation");
354 </script> 358 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698