Bug 1248340 - Part 6: Add tests in easing-test. draft
authorBoris Chiou <boris.chiou@gmail.com>
Mon, 27 Feb 2017 18:30:54 +0800
changeset 490807 ccdf6af11825e13f089e0f1c28fcb170e99feeae
parent 490806 4fd68e48e29bd8c04b25570cd5f16d641bdddbd2
child 490808 3cdd628fc8fe00ed2b92db259ed3aaff19d0aee9
push id47231
push userbmo:boris.chiou@gmail.com
push dateWed, 01 Mar 2017 09:45:55 +0000
bugs1248340
milestone54.0a1
Bug 1248340 - Part 6: Add tests in easing-test. MozReview-Commit-ID: 1tJp0g8CfxH
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/web-animations/__dir__.ini
testing/web-platform/tests/web-animations/resources/easing-tests.js
testing/web-platform/tests/web-animations/testcommon.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -205460,25 +205460,25 @@
    "8ef986f13e7fe7ffeb7403f647b4169ac0d6a138",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffectReadOnly/spacing.html": [
    "2eb6b663f4ec25284370d16042444c43edb80c02",
    "testharness"
   ],
   "web-animations/resources/easing-tests.js": [
-   "190134380a0724f470a03ed0aa20c936bfed8d6c",
+   "643430a171446a3b72c2550df9a3f01abede9ac9",
    "support"
   ],
   "web-animations/resources/keyframe-utils.js": [
    "7a0f21838f4bbda51fe7e0b5d8e55952c6cdcbd4",
    "support"
   ],
   "web-animations/testcommon.js": [
-   "001012b71248cdecba02215c827ab437b672e8c6",
+   "d006a9010160b07b99084cad055dc0563ae19f19",
    "support"
   ],
   "web-animations/timing-model/animation-effects/active-time.html": [
    "42eb1a23e89ae60ccd0a3664a9a583df1eb30d49",
    "testharness"
   ],
   "web-animations/timing-model/animation-effects/current-iteration.html": [
    "b08a35ae832ce33da7fe7fee22e589a6b85a6353",
--- a/testing/web-platform/meta/web-animations/__dir__.ini
+++ b/testing/web-platform/meta/web-animations/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.animations-api.core.enabled:true]
\ No newline at end of file
+prefs: [dom.animations-api.core.enabled:true]
--- a/testing/web-platform/tests/web-animations/resources/easing-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/easing-tests.js
@@ -67,21 +67,27 @@ var gEasingTests = [
     desc: 'easing function which produces values greater than 1',
     easing: 'cubic-bezier(0, 1.5, 1, 1.5)',
     easingFunction: cubicBezier(0, 1.5, 1, 1.5)
   },
   {
     desc: 'easing function which produces values less than 1',
     easing: 'cubic-bezier(0, -0.5, 1, -0.5)',
     easingFunction: cubicBezier(0, -0.5, 1, -0.5)
+  },
+  {
+    desc: 'frames function',
+    easing: 'frames(5)',
+    easingFunction: framesTiming(5)
   }
 ];
 
 var gInvalidEasings = [
   '',
   'test',
   'cubic-bezier(1.1, 0, 1, 1)',
   'cubic-bezier(0, 0, 1.1, 1)',
   'cubic-bezier(-0.1, 0, 1, 1)',
   'cubic-bezier(0, 0, -0.1, 1)',
   'steps(-1, start)',
-  'steps(0.1, start)'
+  'steps(0.1, start)',
+  'frames(1)'
 ];
--- a/testing/web-platform/tests/web-animations/testcommon.js
+++ b/testing/web-platform/tests/web-animations/testcommon.js
@@ -141,16 +141,23 @@ function stepEnd(nsteps) {
 
 function stepStart(nsteps) {
   return function stepStartClosure(x) {
     var result = Math.floor(x * nsteps + 1.0) / nsteps;
     return (result > 1.0) ? 1.0 : result;
   }
 }
 
+function framesTiming(nframes) {
+  return function framesClosure(x) {
+    var result = Math.floor(x * nframes) / (nframes - 1);
+    return (result > 1.0 && x <= 1.0) ? 1.0 : result;
+  }
+}
+
 function waitForAnimationFrames(frameCount) {
   return new Promise(function(resolve, reject) {
     function handleFrame() {
       if (--frameCount <= 0) {
         resolve();
       } else {
         window.requestAnimationFrame(handleFrame); // wait another frame
       }