Bug 1332206 - Move tests for effect easing to timing-model; r=hiro
authorBrian Birtles <birtles@gmail.com>
Wed, 08 Feb 2017 09:25:27 +0900
changeset 341311 63488b90e12a0a1a314119d83eac95f2cdcc3909
parent 341310 a873e39adee42e652f02b68330c703569b1c3ceb
child 341312 d349491c67e45762c72c3fc1bd2d95fe312f958b
push id86684
push usercbook@mozilla.com
push dateWed, 08 Feb 2017 10:31:03 +0000
treeherdermozilla-inbound@c5b88e4e70f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1332206
milestone54.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 1332206 - Move tests for effect easing to timing-model; r=hiro This set of tests are really just testing that we apply the timing function to the animation effect so they belong in the appropriate part of the timing model tests (and should check getComputedTiming not getComputedStyle). I've also started to update tests to ES6 where appropriate since it seems arrow functions, template literals, etc. are all supported on all UAs that are implementing or likely to implement Web Animations. MozReview-Commit-ID: 3kXao0Xi0BA
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
testing/web-platform/tests/web-animations/timing-model/time-transformations/transformed-progress.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -120397,16 +120397,22 @@
     ]
    ],
    "web-animations/timing-model/animations/updating-the-finished-state.html": [
     [
      "/web-animations/timing-model/animations/updating-the-finished-state.html",
      {}
     ]
    ],
+   "web-animations/timing-model/time-transformations/transformed-progress.html": [
+    [
+     "/web-animations/timing-model/time-transformations/transformed-progress.html",
+     {}
+    ]
+   ],
    "webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html": [
     [
      "/webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html",
      {}
     ]
    ],
    "webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html": [
     [
@@ -203871,17 +203877,17 @@
    "577241478fdeca6257711e9f90fec64372bd5637",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/copy-contructor.html": [
    "e1dfb5c05807a37974ecce98bb8c683cc291bfe4",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/effect-easing.html": [
-   "1a8cf09dc40d3a53c0c7f17d6d7da81ab0b11b9e",
+   "aba3feee75ea152159859fb2a98540cac86427a0",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/getComputedTiming.html": [
    "c9dcf7c17010e5495007e000b33aeb4dc89f92b7",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/iterationComposite.html": [
    "5b7dbc28de885751ea952f4fecc2bd07cb3cea11",
@@ -203954,16 +203960,20 @@
   "web-animations/timing-model/animations/set-the-timeline-of-an-animation.html": [
    "6e8e029f813046c3da69b4ff0c9d03d2a56b38a4",
    "testharness"
   ],
   "web-animations/timing-model/animations/updating-the-finished-state.html": [
    "266f1b793aa74a59486081f3ba8f6cbb482e714b",
    "testharness"
   ],
+  "web-animations/timing-model/time-transformations/transformed-progress.html": [
+   "fb4a278d34be56d5b2f07d03e30c55fd03eb1fae",
+   "testharness"
+  ],
   "webaudio/.gitignore": [
    "11bc81247643b0a9fc665f1e4b1f592cc1f4c670",
    "support"
   ],
   "webaudio/OWNERS": [
    "d98264a830bdab63db07061e8b25080188e1aeab",
    "support"
   ],
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
@@ -18,36 +18,16 @@ function assert_style_left_at(animation,
   var portion = time / animation.effect.timing.duration;
   assert_approx_equals(pxToNum(getComputedStyle(animation.effect.target).left),
                        easingFunction(portion) * 100,
                        0.01,
                        'The left of the animation should be approximately ' +
                        easingFunction(portion) * 100 + ' at ' + time + 'ms');
 }
 
-gEffectEasingTests.forEach(function(options) {
-  test(function(t) {
-    var target = createDiv(t);
-    target.style.position = 'absolute';
-    var anim = target.animate([ { left: '0px' }, { left: '100px' } ],
-                              { duration: 1000,
-                                fill: 'forwards',
-                                easing: options.easing });
-    var easing = options.easingFunction;
-
-    anim.pause();
-
-    assert_style_left_at(anim, 0, easing);
-    assert_style_left_at(anim, 250, easing);
-    assert_style_left_at(anim, 500, easing);
-    assert_style_left_at(anim, 750, easing);
-    assert_style_left_at(anim, 1000, easing);
-  }, options.desc);
-});
-
 var gEffectEasingTestsWithKeyframeEasing = [
   {
     desc: 'effect easing produces values greater than 1 with keyframe ' +
           'easing cubic-bezier(0, 0, 0, 0)',
     easing: 'cubic-bezier(0, 1.5, 1, 1.5)',
     keyframeEasing: 'cubic-bezier(0, 0, 0, 0)', // linear
     easingFunction: cubicBezier(0, 1.5, 1, 1.5)
   },
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/timing-model/time-transformations/transformed-progress.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Tests for the transformed progress</title>
+<link rel="help" href="https://w3c.github.io/web-animations/#calculating-the-transformed-progress">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+<script src="../../resources/effect-easing-tests.js"></script>
+<body>
+<div id="log"></div>
+<div id="target"></div>
+<script>
+'use strict';
+
+gEffectEasingTests.forEach(params => {
+  test(function(t) {
+    const target = createDiv(t);
+    const anim   = target.animate(null, { duration: 1000,
+                                          fill: 'forwards',
+                                          easing: params.easing });
+
+    [ 0, 250, 500, 750, 1000 ].forEach(sampleTime => {
+      anim.currentTime = sampleTime;
+      const portion = sampleTime / anim.effect.getComputedTiming().duration;
+      const expectedProgress = params.easingFunction(portion);
+      assert_approx_equals(anim.effect.getComputedTiming().progress,
+                           expectedProgress,
+                           0.01,
+                           'The progress should be approximately ' +
+                           expectedProgress + ` at ${sampleTime}ms`);
+    });
+  }, 'Transformed progress for ' + params.desc);
+});
+
+</script>
+</body>