| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <meta charset=utf-8> | |
| 3 <title>currentIteration of KeyframeEffectReadOnly getComputedTiming() tests</tit
le> | |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
readonly-getcomputedtiming"> | |
| 5 <link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.o
rg"> | |
| 6 <script src="../../../../resources/testharness.js"></script> | |
| 7 <script src="../../../../resources/testharnessreport.js"></script> | |
| 8 <script src="../testcommon.js"></script> | |
| 9 <body> | |
| 10 <div id="log"></div> | |
| 11 <script> | |
| 12 'use strict'; | |
| 13 | |
| 14 function executeTests(tests, description) { | |
| 15 tests.forEach(function(currentTest) { | |
| 16 var testParams = ''; | |
| 17 for (var attr in currentTest.input) { | |
| 18 testParams += ' ' + attr + ':' + currentTest.input[attr]; | |
| 19 } | |
| 20 test(function(t) { | |
| 21 var div = createDiv(t); | |
| 22 var anim = div.animate({ opacity: [ 0, 1 ] }, currentTest.input); | |
| 23 assert_equals(anim.effect.getComputedTiming().currentIteration, | |
| 24 currentTest.before); | |
| 25 anim.currentTime = currentTest.input.delay || 0; | |
| 26 assert_equals(anim.effect.getComputedTiming().currentIteration, | |
| 27 currentTest.active); | |
| 28 if (typeof currentTest.after !== 'undefined') { | |
| 29 anim.finish(); | |
| 30 assert_equals(anim.effect.getComputedTiming().currentIteration, | |
| 31 currentTest.after); | |
| 32 } | |
| 33 }, description + testParams); | |
| 34 }); | |
| 35 } | |
| 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().currentIteration, null); | |
| 41 anim.finished.then(t.step_func(function() { | |
| 42 assert_equals(anim.effect.getComputedTiming().currentIteration, null); | |
| 43 t.done(); | |
| 44 })); | |
| 45 }, 'Test currentIteration during before and after phase when fill is none'); | |
| 46 | |
| 47 var gTests_zero_iterations = [ | |
| 48 { | |
| 49 input: { iterations: 0, | |
| 50 iterationStart: 0, | |
| 51 duration: 0, | |
| 52 delay: 1, | |
| 53 fill: 'both' }, | |
| 54 before: 0, | |
| 55 active: 0, | |
| 56 after: 0 | |
| 57 }, | |
| 58 | |
| 59 { | |
| 60 input: { iterations: 0, | |
| 61 iterationStart: 0, | |
| 62 duration: 100, | |
| 63 delay: 1, | |
| 64 fill: 'both' }, | |
| 65 before: 0, | |
| 66 active: 0, | |
| 67 after: 0 | |
| 68 }, | |
| 69 | |
| 70 { | |
| 71 input: { iterations: 0, | |
| 72 iterationStart: 0, | |
| 73 duration: Infinity, | |
| 74 delay: 1, | |
| 75 fill: 'both' }, | |
| 76 before: 0, | |
| 77 active: 0, | |
| 78 after: 0 | |
| 79 }, | |
| 80 | |
| 81 { | |
| 82 input: { iterations: 0, | |
| 83 iterationStart: 2.5, | |
| 84 duration: 0, | |
| 85 delay: 1, | |
| 86 fill: 'both' }, | |
| 87 before: 2, | |
| 88 active: 2, | |
| 89 after: 2 | |
| 90 }, | |
| 91 | |
| 92 { | |
| 93 input: { iterations: 0, | |
| 94 iterationStart: 2.5, | |
| 95 duration: 100, | |
| 96 delay: 1, | |
| 97 fill: 'both' }, | |
| 98 before: 2, | |
| 99 active: 2, | |
| 100 after: 2 | |
| 101 }, | |
| 102 | |
| 103 { | |
| 104 input: { iterations: 0, | |
| 105 iterationStart: 2.5, | |
| 106 duration: Infinity, | |
| 107 delay: 1, | |
| 108 fill: 'both' }, | |
| 109 before: 2, | |
| 110 active: 2, | |
| 111 after: 2 | |
| 112 }, | |
| 113 | |
| 114 { | |
| 115 input: { iterations: 0, | |
| 116 iterationStart: 3, | |
| 117 duration: 0, | |
| 118 delay: 1, | |
| 119 fill: 'both' }, | |
| 120 before: 3, | |
| 121 active: 3, | |
| 122 after: 3 | |
| 123 }, | |
| 124 | |
| 125 { | |
| 126 input: { iterations: 0, | |
| 127 iterationStart: 3, | |
| 128 duration: 100, | |
| 129 delay: 1, | |
| 130 fill: 'both' }, | |
| 131 before: 3, | |
| 132 active: 3, | |
| 133 after: 3 | |
| 134 }, | |
| 135 | |
| 136 { | |
| 137 input: { iterations: 0, | |
| 138 iterationStart: 3, | |
| 139 duration: Infinity, | |
| 140 delay: 1, | |
| 141 fill: 'both' }, | |
| 142 before: 3, | |
| 143 active: 3, | |
| 144 after: 3 | |
| 145 } | |
| 146 ]; | |
| 147 | |
| 148 var gTests_integer_iterations = [ | |
| 149 { | |
| 150 input: { iterations: 3, | |
| 151 iterationStart: 0, | |
| 152 duration: 0, | |
| 153 delay: 1, | |
| 154 fill: 'both' }, | |
| 155 before: 0, | |
| 156 active: 2, | |
| 157 after: 2 | |
| 158 }, | |
| 159 | |
| 160 { | |
| 161 input: { iterations: 3, | |
| 162 iterationStart: 0, | |
| 163 duration: 100, | |
| 164 delay: 1, | |
| 165 fill: 'both' }, | |
| 166 before: 0, | |
| 167 active: 0, | |
| 168 after: 2 | |
| 169 }, | |
| 170 | |
| 171 { | |
| 172 input: { iterations: 3, | |
| 173 iterationStart: 0, | |
| 174 duration: Infinity, | |
| 175 delay: 1, | |
| 176 fill: 'both' }, | |
| 177 before: 0, | |
| 178 active: 0 | |
| 179 }, | |
| 180 | |
| 181 { | |
| 182 input: { iterations: 3, | |
| 183 iterationStart: 2.5, | |
| 184 duration: 0, | |
| 185 delay: 1, | |
| 186 fill: 'both' }, | |
| 187 before: 2, | |
| 188 active: 5, | |
| 189 after: 5 | |
| 190 }, | |
| 191 | |
| 192 { | |
| 193 input: { iterations: 3, | |
| 194 iterationStart: 2.5, | |
| 195 duration: 100, | |
| 196 delay: 1, | |
| 197 fill: 'both' }, | |
| 198 before: 2, | |
| 199 active: 2, | |
| 200 after: 5 | |
| 201 }, | |
| 202 | |
| 203 { | |
| 204 input: { iterations: 3, | |
| 205 iterationStart: 2.5, | |
| 206 duration: Infinity, | |
| 207 delay: 1, | |
| 208 fill: 'both' }, | |
| 209 before: 2, | |
| 210 active: 2 | |
| 211 }, | |
| 212 | |
| 213 { | |
| 214 input: { iterations: 3, | |
| 215 iterationStart: 3, | |
| 216 duration: 0, | |
| 217 delay: 1, | |
| 218 fill: 'both' }, | |
| 219 before: 3, | |
| 220 active: 5, | |
| 221 after: 5 | |
| 222 }, | |
| 223 | |
| 224 { | |
| 225 input: { iterations: 3, | |
| 226 iterationStart: 3, | |
| 227 duration: 100, | |
| 228 delay: 1, | |
| 229 fill: 'both' }, | |
| 230 before: 3, | |
| 231 active: 3, | |
| 232 after: 5 | |
| 233 }, | |
| 234 | |
| 235 { | |
| 236 input: { iterations: 3, | |
| 237 iterationStart: 3, | |
| 238 duration: Infinity, | |
| 239 delay: 1, | |
| 240 fill: 'both' }, | |
| 241 before: 3, | |
| 242 active: 3 | |
| 243 } | |
| 244 ]; | |
| 245 | |
| 246 var gTests_fractional_iterations = [ | |
| 247 { | |
| 248 input: { iterations: 3.5, | |
| 249 iterationStart: 0, | |
| 250 duration: 0, | |
| 251 delay: 1, | |
| 252 fill: 'both' }, | |
| 253 before: 0, | |
| 254 active: 3, | |
| 255 after: 3 | |
| 256 }, | |
| 257 | |
| 258 { | |
| 259 input: { iterations: 3.5, | |
| 260 iterationStart: 0, | |
| 261 duration: 100, | |
| 262 delay: 1, | |
| 263 fill: 'both' }, | |
| 264 before: 0, | |
| 265 active: 0, | |
| 266 after: 3 | |
| 267 }, | |
| 268 | |
| 269 { | |
| 270 input: { iterations: 3.5, | |
| 271 iterationStart: 0, | |
| 272 duration: Infinity, | |
| 273 delay: 1, | |
| 274 fill: 'both' }, | |
| 275 before: 0, | |
| 276 active: 0 | |
| 277 }, | |
| 278 | |
| 279 { | |
| 280 input: { iterations: 3.5, | |
| 281 iterationStart: 2.5, | |
| 282 duration: 0, | |
| 283 delay: 1, | |
| 284 fill: 'both' }, | |
| 285 before: 2, | |
| 286 active: 5, | |
| 287 after: 5 | |
| 288 }, | |
| 289 | |
| 290 { | |
| 291 input: { iterations: 3.5, | |
| 292 iterationStart: 2.5, | |
| 293 duration: 100, | |
| 294 delay: 1, | |
| 295 fill: 'both' }, | |
| 296 before: 2, | |
| 297 active: 2, | |
| 298 after: 5 | |
| 299 }, | |
| 300 | |
| 301 { | |
| 302 input: { iterations: 3.5, | |
| 303 iterationStart: 2.5, | |
| 304 duration: Infinity, | |
| 305 delay: 1, | |
| 306 fill: 'both' }, | |
| 307 before: 2, | |
| 308 active: 2 | |
| 309 }, | |
| 310 | |
| 311 { | |
| 312 input: { iterations: 3.5, | |
| 313 iterationStart: 3, | |
| 314 duration: 0, | |
| 315 delay: 1, | |
| 316 fill: 'both' }, | |
| 317 before: 3, | |
| 318 active: 6, | |
| 319 after: 6 | |
| 320 }, | |
| 321 | |
| 322 { | |
| 323 input: { iterations: 3.5, | |
| 324 iterationStart: 3, | |
| 325 duration: 100, | |
| 326 delay: 1, | |
| 327 fill: 'both' }, | |
| 328 before: 3, | |
| 329 active: 3, | |
| 330 after: 6 | |
| 331 }, | |
| 332 | |
| 333 { | |
| 334 input: { iterations: 3.5, | |
| 335 iterationStart: 3, | |
| 336 duration: Infinity, | |
| 337 delay: 1, | |
| 338 fill: 'both' }, | |
| 339 before: 3, | |
| 340 active: 3 | |
| 341 } | |
| 342 ]; | |
| 343 | |
| 344 var gTests_infinity_iterations = [ | |
| 345 { | |
| 346 input: { iterations: Infinity, | |
| 347 iterationStart: 0, | |
| 348 duration: 0, | |
| 349 delay: 1, | |
| 350 fill: 'both' }, | |
| 351 before: 0, | |
| 352 active: Infinity, | |
| 353 after: Infinity | |
| 354 }, | |
| 355 | |
| 356 { | |
| 357 input: { iterations: Infinity, | |
| 358 iterationStart: 0, | |
| 359 duration: 100, | |
| 360 delay: 1, | |
| 361 fill: 'both' }, | |
| 362 before: 0, | |
| 363 active: 0 | |
| 364 }, | |
| 365 | |
| 366 { | |
| 367 input: { iterations: Infinity, | |
| 368 iterationStart: 0, | |
| 369 duration: Infinity, | |
| 370 delay: 1, | |
| 371 fill: 'both' }, | |
| 372 before: 0, | |
| 373 active: 0 | |
| 374 }, | |
| 375 | |
| 376 { | |
| 377 input: { iterations: Infinity, | |
| 378 iterationStart: 2.5, | |
| 379 duration: 0, | |
| 380 delay: 1, | |
| 381 fill: 'both' }, | |
| 382 before: 2, | |
| 383 active: Infinity, | |
| 384 after: Infinity | |
| 385 }, | |
| 386 | |
| 387 { | |
| 388 input: { iterations: Infinity, | |
| 389 iterationStart: 2.5, | |
| 390 duration: 100, | |
| 391 delay: 1, | |
| 392 fill: 'both' }, | |
| 393 before: 2, | |
| 394 active: 2 | |
| 395 }, | |
| 396 | |
| 397 { | |
| 398 input: { iterations: Infinity, | |
| 399 iterationStart: 2.5, | |
| 400 duration: Infinity, | |
| 401 delay: 1, | |
| 402 fill: 'both' }, | |
| 403 before: 2, | |
| 404 active: 2 | |
| 405 }, | |
| 406 | |
| 407 { | |
| 408 input: { iterations: Infinity, | |
| 409 iterationStart: 3, | |
| 410 duration: 0, | |
| 411 delay: 1, | |
| 412 fill: 'both' }, | |
| 413 before: 3, | |
| 414 active: Infinity, | |
| 415 after: Infinity | |
| 416 }, | |
| 417 | |
| 418 { | |
| 419 input: { iterations: Infinity, | |
| 420 iterationStart: 3, | |
| 421 duration: 100, | |
| 422 delay: 1, | |
| 423 fill: 'both' }, | |
| 424 before: 3, | |
| 425 active: 3 | |
| 426 }, | |
| 427 | |
| 428 { | |
| 429 input: { iterations: Infinity, | |
| 430 iterationStart: 3, | |
| 431 duration: Infinity, | |
| 432 delay: 1, | |
| 433 fill: 'both' }, | |
| 434 before: 3, | |
| 435 active: 3 | |
| 436 } | |
| 437 ]; | |
| 438 | |
| 439 executeTests(gTests_zero_iterations, "Test zero iterations:"); | |
| 440 executeTests(gTests_integer_iterations, "Test integer iterations:"); | |
| 441 executeTests(gTests_fractional_iterations, "Test fractional iterations:"); | |
| 442 executeTests(gTests_infinity_iterations, "Test infinity iterations:"); | |
| 443 | |
| 444 </script> | |
| 445 </body> | |
| OLD | NEW |