Bug 1415448 - Move tests from AnimationEffectTiming/getAnimations.html to Animatable/getAnimations.html; r=hiro
authorBrian Birtles <birtles@gmail.com>
Fri, 10 Nov 2017 17:08:00 +0900
changeset 444424 b652edba2199b2c3a8e905a780a9bbeba50edb37
parent 444423 edba74152c40e45cd641570b2ffe0d0d126d3db0
child 444425 2f496f8ba8923d9c5cb5c578a7252170bc9932a1
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1415448
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415448 - Move tests from AnimationEffectTiming/getAnimations.html to Animatable/getAnimations.html; r=hiro As well as moving these tests, this patch simplifies them in several cases and tries to make them match the existing tests in that file (e.g. using 'animation' instead of 'anim', using MS_PER_SEC, using assert_array_equals, etc.)
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getAnimations.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -354746,22 +354746,16 @@
     ]
    ],
    "web-animations/interfaces/AnimationEffectTiming/fill.html": [
     [
      "/web-animations/interfaces/AnimationEffectTiming/fill.html",
      {}
     ]
    ],
-   "web-animations/interfaces/AnimationEffectTiming/getAnimations.html": [
-    [
-     "/web-animations/interfaces/AnimationEffectTiming/getAnimations.html",
-     {}
-    ]
-   ],
    "web-animations/interfaces/AnimationEffectTiming/idlharness.html": [
     [
      "/web-animations/interfaces/AnimationEffectTiming/idlharness.html",
      {}
     ]
    ],
    "web-animations/interfaces/AnimationEffectTiming/iterationStart.html": [
     [
@@ -585818,17 +585812,17 @@
    "284d173b6875923ddd894d2ac7498cd07311c001",
    "testharness"
   ],
   "web-animations/interfaces/Animatable/animate.html": [
    "dfba0ceb784a9ba847f0f0db1234a59c783ecfab",
    "testharness"
   ],
   "web-animations/interfaces/Animatable/getAnimations.html": [
-   "9ced6f956324856d94538c3ea7304f37f3da10e6",
+   "f2c2b812cf87285cb1b3c62cc2c971978eb27dcc",
    "testharness"
   ],
   "web-animations/interfaces/Animation/cancel.html": [
    "d624285aa264c5b2d823e85fdbfa05f47f26e32a",
    "testharness"
   ],
   "web-animations/interfaces/Animation/constructor.html": [
    "24a0f7b8f147c12ca2a1aacefa62ab52670fa72c",
@@ -585905,20 +585899,16 @@
   "web-animations/interfaces/AnimationEffectTiming/endDelay.html": [
    "0c4e2cfee8ecb4fb7879df6c85ba0ba38310662d",
    "testharness"
   ],
   "web-animations/interfaces/AnimationEffectTiming/fill.html": [
    "c0237dd37bd3e56e32bd3e027c5f9357081cfef0",
    "testharness"
   ],
-  "web-animations/interfaces/AnimationEffectTiming/getAnimations.html": [
-   "e0ad6da869693c4e4b57aa2e5e3cb4ec557c7bc8",
-   "testharness"
-  ],
   "web-animations/interfaces/AnimationEffectTiming/idlharness.html": [
    "a4e72d3ebf93a0bb6934f887c3da250a2ab67b63",
    "testharness"
   ],
   "web-animations/interfaces/AnimationEffectTiming/iterationStart.html": [
    "c4d40ffdd9080732f202d9067f901cc065c470de",
    "testharness"
   ],
--- a/testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
@@ -62,10 +62,95 @@ test(function(t) {
   var div = createDiv(t);
   var animation = div.animate(null, {
     duration: 100 * MS_PER_SEC,
     delay: 100 * MS_PER_SEC,
   });
   assert_array_equals(div.getAnimations(), [animation]);
 }, 'Returns animations in their delay phase');
 
+test(function(t) {
+  var div = createDiv(t);
+  var animation = div.animate(null, 100 * MS_PER_SEC);
+
+  animation.finish();
+  assert_array_equals(div.getAnimations(), [],
+                      'Animation should not be returned when it is finished');
+
+  animation.effect.timing.duration += 100 * MS_PER_SEC;
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned after extending the'
+                      + ' duration');
+
+  animation.effect.timing.duration = 0;
+  assert_array_equals(div.getAnimations(), [],
+                      'Animation should not be returned after setting the'
+                      + ' duration to zero');
+}, 'Returns animations based on dynamic changes to individual'
+   + ' animations\' duration');
+
+test(function(t) {
+  var div = createDiv(t);
+  var animation = div.animate(null, 100 * MS_PER_SEC);
+
+  animation.effect.timing.endDelay = -200 * MS_PER_SEC;
+  assert_array_equals(div.getAnimations(), [],
+                      'Animation should not be returned after setting a'
+                      + ' negative end delay such that the end time is less'
+                      + ' than the current time');
+
+  animation.effect.timing.endDelay = 100 * MS_PER_SEC;
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned after setting a positive'
+                      + ' end delay such that the end time is more than the'
+                      + ' current time');
+}, 'Returns animations based on dynamic changes to individual'
+   + ' animations\' end delay');
+
+test(function(t) {
+  var div = createDiv(t);
+  var animation = div.animate(null, 100 * MS_PER_SEC);
+
+  animation.finish();
+  assert_array_equals(div.getAnimations(), [],
+                      'Animation should not be returned when it is finished');
+
+  animation.effect.timing.iterations = 10;
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned after inreasing the'
+                      + ' number of iterations');
+
+  animation.effect.timing.iterations = 0;
+  assert_array_equals(div.getAnimations(), [],
+                      'Animations should not be returned after setting the'
+                      + ' iteration count to zero');
+
+  animation.effect.timing.iterations = Infinity;
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned after inreasing the'
+                      + ' number of iterations to infinity');
+}, 'Returns animations based on dynamic changes to individual'
+   + ' animations\' iteration count');
+
+test(function(t) {
+  var div = createDiv(t);
+  var animation = div.animate(null,
+                              { duration: 100 * MS_PER_SEC,
+                                delay: 50 * MS_PER_SEC,
+                                endDelay: -50 * MS_PER_SEC });
+
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned at during delay phase');
+
+  animation.currentTime = 50 * MS_PER_SEC;
+  assert_array_equals(div.getAnimations(), [animation],
+                      'Animation should be returned after seeking to the start'
+                      + ' of the active interval');
+
+  animation.currentTime = 100 * MS_PER_SEC;
+  assert_array_equals(div.getAnimations(), [],
+                      'Animation should not be returned after seeking to the'
+                      + ' clipped end of the active interval');
+}, 'Returns animations based on dynamic changes to individual'
+   + ' animations\' current time');
+
 </script>
 </body>
deleted file mode 100644
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getAnimations.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>Element.getAnimations</title>
-<link rel="help" href="http://w3c.github.io/web-animations/#animationeffecttiming">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="../../testcommon.js"></script>
-<body>
-<div id="log"></div>
-<script>
-'use strict';
-
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
-  anim.finish();
-  assert_equals(div.getAnimations().length, 0, 'animation finished');
-  anim.effect.timing.duration += 100000;
-  assert_equals(div.getAnimations()[0], anim, 'set duration 102000');
-  anim.effect.timing.duration = 0;
-  assert_equals(div.getAnimations().length, 0, 'set duration 0');
-  anim.effect.timing.duration = 'auto';
-  assert_equals(div.getAnimations().length, 0, 'set duration \'auto\'');
-}, 'when duration is changed');
-
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
-
-  anim.effect.timing.endDelay = -3000;
-  assert_equals(div.getAnimations().length, 0,
-    'set negative endDelay so as endTime is less than currentTime');
-  anim.effect.timing.endDelay = 1000;
-  assert_equals(div.getAnimations()[0], anim,
-    'set positive endDelay so as endTime is more than currentTime');
-
-  anim.effect.timing.duration = 1000;
-  anim.currentTime = 1500;
-  assert_equals(div.getAnimations().length, 0,
-    'set currentTime less than endTime');
-  anim.effect.timing.endDelay = -500;
-  anim.currentTime = 400;
-  assert_equals(div.getAnimations()[0], anim,
-    'set currentTime less than endTime when endDelay is negative value');
-  anim.currentTime = 500;
-  assert_equals(div.getAnimations().length, 0,
-    'set currentTime same as endTime when endDelay is negative value');
-  anim.currentTime = 1000;
-  assert_equals(div.getAnimations().length, 0,
-    'set currentTime same as duration when endDelay is negative value');
-}, 'when endDelay is changed');
-
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
-  anim.finish();
-  assert_equals(div.getAnimations().length, 0, 'animation finished');
-  anim.effect.timing.iterations = 10;
-  assert_equals(div.getAnimations()[0], anim, 'set iterations 10');
-  anim.effect.timing.iterations = 0;
-  assert_equals(div.getAnimations().length, 0, 'set iterations 0');
-  anim.effect.timing.iterations = Infinity;
-  assert_equals(div.getAnimations().length, 1, 'set iterations Infinity');
-}, 'when iterations is changed');
-
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] },
-                         { duration: 1000, delay: 500, endDelay: -500 });
-  assert_equals(div.getAnimations()[0], anim, 'when currentTime 0');
-  anim.currentTime = 500;
-  assert_equals(div.getAnimations()[0], anim, 'set currentTime 500');
-  anim.currentTime = 1000;
-  assert_equals(div.getAnimations().length, 0, 'set currentTime 1000');
-}, 'when currentTime changed in duration:1000, delay: 500, endDelay: -500');
-
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] },
-                         { duration: 1000, delay: -500, endDelay: -500 });
-  assert_equals(div.getAnimations().length, 0, 'when currentTime 0');
-  anim.currentTime = 500;
-  assert_equals(div.getAnimations().length, 0, 'set currentTime 500');
-  anim.currentTime = 1000;
-  assert_equals(div.getAnimations().length, 0, 'set currentTime 1000');
-}, 'when currentTime changed in duration:1000, delay: -500, endDelay: -500');
-
-
-</script>
-</body>