Bug 1248340 - Part 6: Add tests in easing-test.
MozReview-Commit-ID: 1tJp0g8CfxH
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -205631,25 +205631,25 @@
"8ef986f13e7fe7ffeb7403f647b4169ac0d6a138",
"testharness"
],
"web-animations/interfaces/KeyframeEffectReadOnly/spacing.html": [
"2eb6b663f4ec25284370d16042444c43edb80c02",
"testharness"
],
"web-animations/resources/easing-tests.js": [
- "190134380a0724f470a03ed0aa20c936bfed8d6c",
+ "d07563840ebcddfa0b0ba7ee1e5561faa56564e6",
"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/tests/web-animations/resources/easing-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/easing-tests.js
@@ -34,16 +34,21 @@ var gEasingTests = [
},
{
desc: 'steps(2, end) function',
easing: 'steps(2, end)',
easingFunction: stepEnd(2),
serialization: 'steps(2)'
},
{
+ desc: 'frames function',
+ easing: 'frames(5)',
+ easingFunction: framesTiming(5)
+ },
+ {
desc: 'linear function',
easing: 'linear', // cubic-bezier(0, 0, 1.0, 1.0)
easingFunction: cubicBezier(0, 0, 1.0, 1.0)
},
{
desc: 'ease function',
easing: 'ease', // cubic-bezier(0.25, 0.1, 0.25, 1.0)
easingFunction: cubicBezier(0.25, 0.1, 0.25, 1.0)
@@ -78,10 +83,18 @@ var gEasingTests = [
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)',
+ 'frames',
+ 'frames()',
+ 'frames(,)',
+ 'frames(a)',
+ 'frames(2.0)',
+ 'frames(2.5)',
+ 'frames(2 3)'
];
--- 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
}