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
--- 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>