Bug 1343589 - Move tests for reversing an animation to the timing-model folder draft
authorBrian Birtles <birtles@gmail.com>
Tue, 28 Mar 2017 14:51:50 +0900
changeset 552212 0ac36fef2946dabb7a0bd8291b90e9a0a6b5d743
parent 552073 a6f35285bd1e674553527873614c55e0b7366bdb
child 552213 4b98a79d80d9a11c3e32936327afadc575e8da24
push id51290
push userbbirtles@mozilla.com
push dateTue, 28 Mar 2017 05:52:19 +0000
bugs1343589
milestone55.0a1
Bug 1343589 - Move tests for reversing an animation to the timing-model folder We are gradually line the tests up better with sections in the spec. Given that these tests are concerned with testing the "reverse an animation" procedure in the spec (and not the API per se) they should be moved to an appropriate subdirectory of timing-model. We also update the test titles to make it clear that these tests are really covering the timing model, not the API. MozReview-Commit-ID: J5gc3HZg9qv
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -122377,22 +122377,16 @@
     ]
    ],
    "web-animations/interfaces/Animation/ready.html": [
     [
      "/web-animations/interfaces/Animation/ready.html",
      {}
     ]
    ],
-   "web-animations/interfaces/Animation/reverse.html": [
-    [
-     "/web-animations/interfaces/Animation/reverse.html",
-     {}
-    ]
-   ],
    "web-animations/interfaces/Animation/startTime.html": [
     [
      "/web-animations/interfaces/Animation/startTime.html",
      {}
     ]
    ],
    "web-animations/interfaces/AnimationEffectTiming/delay.html": [
     [
@@ -122575,16 +122569,22 @@
     ]
    ],
    "web-animations/timing-model/animations/current-time.html": [
     [
      "/web-animations/timing-model/animations/current-time.html",
      {}
     ]
    ],
+   "web-animations/timing-model/animations/reversing-an-animation.html": [
+    [
+     "/web-animations/timing-model/animations/reversing-an-animation.html",
+     {}
+    ]
+   ],
    "web-animations/timing-model/animations/set-the-animation-start-time.html": [
     [
      "/web-animations/timing-model/animations/set-the-animation-start-time.html",
      {}
     ]
    ],
    "web-animations/timing-model/animations/set-the-target-effect-of-an-animation.html": [
     [
@@ -207692,20 +207692,16 @@
   "web-animations/interfaces/Animation/playbackRate.html": [
    "d0c73c24ed6ea6d43565ef81a3b200336a2133cd",
    "testharness"
   ],
   "web-animations/interfaces/Animation/ready.html": [
    "f79ea4e2bfc3bc83a7ac96634cbb2d5f21f6c1f5",
    "testharness"
   ],
-  "web-animations/interfaces/Animation/reverse.html": [
-   "669b8b6722a2eed4383574c3fab9738b9702d723",
-   "testharness"
-  ],
   "web-animations/interfaces/Animation/startTime.html": [
    "284d55c141e4a93def32393577888ffc215a8b15",
    "testharness"
   ],
   "web-animations/interfaces/AnimationEffectTiming/delay.html": [
    "ee2d870fae13e77e500e7067b89dbb79bd2d209a",
    "testharness"
   ],
@@ -207836,16 +207832,20 @@
   "web-animations/timing-model/animation-effects/simple-iteration-progress.html": [
    "53a4a6c6c6d07e00fecc50e5de831862e7bf4b2e",
    "testharness"
   ],
   "web-animations/timing-model/animations/current-time.html": [
    "b1ea8e490cbfb69fd71b91a90e7e2d9ce99f42d3",
    "testharness"
   ],
+  "web-animations/timing-model/animations/reversing-an-animation.html": [
+   "91d0704525d4aeacb0a31592e29bf7aab9908660",
+   "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",
    "testharness"
   ],
rename from testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
rename to testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
@@ -1,12 +1,13 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
-<title>Animation.reverse()</title>
-<link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-reverse">
+<title>Reversing an animation</title>
+<link rel="help"
+      href="https://w3c.github.io/web-animations/#reverse-an-animation">
 <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";
 
@@ -21,134 +22,140 @@ promise_test(function(t) {
     assert_greater_than_equal(animation.currentTime, 0,
       'currentTime expected to be greater than 0, one frame after starting');
     animation.currentTime = 50 * MS_PER_SEC;
     var previousPlaybackRate = animation.playbackRate;
     animation.reverse();
     assert_equals(animation.playbackRate, -previousPlaybackRate,
       'playbackRate should be inverted');
   });
-}, 'reverse() inverts playbackRate');
+}, 'Reversing an animation inverts the playback rate');
 
 promise_test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
                                    iterations: Infinity});
   animation.currentTime = 50 * MS_PER_SEC;
   animation.pause();
 
   return animation.ready.then(function() {
     animation.reverse();
     return animation.ready;
   }).then(function() {
     assert_equals(animation.playState, 'running',
       'Animation.playState should be "running" after reverse()');
   });
-}, 'reverse() starts to play when pausing animation');
+}, 'Reversing an animation plays a pausing animation');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
   animation.currentTime = 50 * MS_PER_SEC;
   animation.reverse();
 
   assert_equals(animation.currentTime, 50 * MS_PER_SEC,
-    'reverse() should not change the currentTime ' +
-    'if the currentTime is in the middle of animation duration');
-}, 'reverse() maintains the same currentTime');
+    'The current time should not change it is in the middle of ' +
+    'the animation duration');
+}, 'Reversing an animation maintains the same current time');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
   animation.currentTime = 200 * MS_PER_SEC;
   animation.reverse();
 
   assert_equals(animation.currentTime, 100 * MS_PER_SEC,
     'reverse() should start playing from the animation effect end ' +
     'if the playbackRate > 0 and the currentTime > effect end');
-}, 'reverse() when playbackRate > 0 and currentTime > effect end');
+}, 'Reversing an animation when playbackRate > 0 and currentTime > ' +
+   'effect end should make it play from the end');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
 
   animation.currentTime = -200 * MS_PER_SEC;
   animation.reverse();
 
   assert_equals(animation.currentTime, 100 * MS_PER_SEC,
     'reverse() should start playing from the animation effect end ' +
     'if the playbackRate > 0 and the currentTime < 0');
-}, 'reverse() when playbackRate > 0 and currentTime < 0');
+}, 'Reversing an animation when playbackRate > 0 and currentTime < 0 ' +
+   'should make it play from the end');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
   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');
-}, 'reverse() when playbackRate < 0 and currentTime < 0');
+}, 'Reversing an animation when playbackRate < 0 and currentTime < 0 ' +
+   'should make it play from the start');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
   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 > effect end');
-}, 'reverse() when playbackRate < 0 and currentTime > effect end');
+}, 'Reversing an animation when playbackRate < 0 and currentTime > effect ' +
+   'end should make it play from the start');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
                                    iterations: Infinity});
   animation.currentTime = -200 * MS_PER_SEC;
 
   assert_throws('InvalidStateError',
     function () { animation.reverse(); },
     'reverse() should throw InvalidStateError ' +
     'if the playbackRate > 0 and the currentTime < 0 ' +
     'and the target effect is positive infinity');
-}, 'reverse() when playbackRate > 0 and currentTime < 0 ' +
-   'and the target effect end is positive infinity');
+}, 'Reversing an animation when playbackRate > 0 and currentTime < 0 ' +
+   'and the target effect end is positive infinity should 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');
-}, 'reverse() when playbackRate < 0 and currentTime < 0 ' +
-   'and the target effect end is positive infinity');
+}, 'Reversing an animation when playbackRate < 0 and currentTime < 0 ' +
+   'and the target effect end is positive infinity should make it play ' +
+   'from the start');
 
 test(function(t) {
   var div = createDiv(t);
   var animation = div.animate({}, 100 * MS_PER_SEC);
   animation.playbackRate = 0;
   animation.currentTime = 50 * MS_PER_SEC;
   animation.reverse();
 
   assert_equals(animation.playbackRate, 0,
     'reverse() should preserve playbackRate if the playbackRate == 0');
   assert_equals(animation.currentTime, 50 * MS_PER_SEC,
     'reverse() should not affect the currentTime if the playbackRate == 0');
   t.done();
-}, 'reverse() when playbackRate == 0');
+}, 'Reversing when when playbackRate == 0 should preserve the current ' +
+   'time and playback rate');
 
 test(function(t) {
   var div = createDiv(t);
   var animation =
     new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC), null);
 
   assert_throws('InvalidStateError', function() { animation.reverse(); });
 }, 'Reversing an animation without an active timeline throws an ' +