Bug 1415448 - Move tests from AnimationEffectTiming/getAnimations.html to Animatable/getAnimations.html; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Thu, 09 Nov 2017 16:00:36 +0900
changeset 696032 a986bb89cb0dd1099504e3bf5c3f67fdf41d334b
parent 696031 901decbd0d09446251756894b79179d0b94d6ba6
child 739768 3f26961d00a0d66c47a191286eae39cd6e2a85ea
push id88616
push userbbirtles@mozilla.com
push dateFri, 10 Nov 2017 04:12:48 +0000
reviewershiro
bugs1415448
milestone58.0a1
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.) MozReview-Commit-ID: Gf7rucG9ml1
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -585812,17 +585812,17 @@
    "284d173b6875923ddd894d2ac7498cd07311c001",
    "testharness"
   ],
   "web-animations/interfaces/Animatable/animate.html": [
    "dfba0ceb784a9ba847f0f0db1234a59c783ecfab",
    "testharness"
   ],
   "web-animations/interfaces/Animatable/getAnimations.html": [
-   "9ced6f956324856d94538c3ea7304f37f3da10e6",
+   "eba448ec228fc32470b9dbb08a9d7585d08d15b5",
    "testharness"
   ],
   "web-animations/interfaces/Animation/cancel.html": [
    "d624285aa264c5b2d823e85fdbfa05f47f26e32a",
    "testharness"
   ],
   "web-animations/interfaces/Animation/constructor.html": [
    "47f96027cac889d8332b6caa7a6fbf0c17769398",
--- 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(), [],
+                      'Animations 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>