Bug 1343589 - Add a test for reversing with an infinite target effect end and playback rate of zero
We already pass this test but it seemed like a useful test to add since I was
unsure if the early return we have in Animation::Reverse() is valid or not.
MozReview-Commit-ID: J38Euno3VP6
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -207833,17 +207833,17 @@
"53a4a6c6c6d07e00fecc50e5de831862e7bf4b2e",
"testharness"
],
"web-animations/timing-model/animations/current-time.html": [
"b1ea8e490cbfb69fd71b91a90e7e2d9ce99f42d3",
"testharness"
],
"web-animations/timing-model/animations/reversing-an-animation.html": [
- "9f8e9adb260f4b3cea834bbec6b603c50acbb9fd",
+ "80327fe9a7c68d280b7b4cfba42d081358ee1ea7",
"testharness"
],
"web-animations/timing-model/animations/set-the-animation-start-time.html": [
"84afa495b1a4c467e27b1394f6449a18c58ed98d",
"testharness"
],
"web-animations/timing-model/animations/set-the-target-effect-of-an-animation.html": [
"840be610db4bce6d6fd1c22710e494a75ee95eba",
--- a/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
@@ -130,16 +130,32 @@ test(function(t) {
assert_equals(animation.playbackRate, 1, 'playbackRate remains unchanged');
}, 'When reversing throws an exception, the playback rate remains unchanged');
test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
+ animation.currentTime = -200 * MS_PER_SEC;
+ animation.playbackRate = 0;
+
+ try {
+ animation.reverse();
+ } catch (e) {
+ assert_unreached(`Unexpected exception when calling reverse(): ${e}`);
+ }
+}, 'Reversing animation when playbackRate = 0 and currentTime < 0 ' +
+ 'and the target effect end is positive infinity should NOT throw an ' +
+ 'exception');
+
+test(function(t) {
+ var div = createDiv(t);
+ var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
+ iterations: Infinity});
animation.playbackRate = -1;
animation.currentTime = -200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 0,
'reverse() should start playing from the start of animation time ' +
'if the playbackRate < 0 and the currentTime < 0 ' +
'and the target effect is positive infinity');