Update web-platform-tests to revision 58b72393db0bd273bb93268c33666cf893feb985

This commit is contained in:
Josh Matthews 2017-10-31 08:58:31 -04:00
parent 43a4f01647
commit 64e0a52537
12717 changed files with 59835 additions and 59820 deletions

View file

@ -0,0 +1,54 @@
'use strict';
function test_interpolation(settings, expectations) {
// Returns a timing function that at 0.5 evaluates to progress.
function timingFunction(progress) {
if (progress === 0)
return 'steps(1, end)';
if (progress === 1)
return 'steps(1, start)';
var y = (8 * progress - 1) / 6;
return 'cubic-bezier(0, ' + y + ', 1, ' + y + ')';
}
test(function(){
assert_true(CSS.supports(settings.property, settings.from), 'Value "' + settings.from + '" is supported by ' + settings.property);
assert_true(CSS.supports(settings.property, settings.to), 'Value "' + settings.to + '" is supported by ' + settings.property);
}, '"' + settings.from + '" and "' + settings.to + '" are valid ' + settings.property + ' values');
for (var i = 0; i < expectations.length; ++i) {
var progress = expectations[i].at;
var expectation = expectations[i].expect;
var animationId = 'anim' + i;
var targetId = 'target' + i;
var referenceId = 'reference' + i;
test(function(){
assert_true(CSS.supports(settings.property, expectation), 'Value "' + expectation + '" is supported by ' + settings.property);
var stylesheet = document.createElement('style');
stylesheet.textContent =
'#' + targetId + ' {\n' +
' animation: 2s ' + timingFunction(progress) + ' -1s paused ' + animationId + ';\n' +
'}\n' +
'@keyframes ' + animationId + ' {\n' +
' 0% { ' + settings.property + ': ' + settings.from + '; }\n' +
' 100% { ' + settings.property + ': ' + settings.to + '; }\n' +
'}\n' +
'#' + referenceId + ' {\n' +
' ' + settings.property + ': ' + expectation + ';\n' +
'}\n';
document.head.appendChild(stylesheet);
var target = document.createElement('div');
target.id = targetId;
document.body.appendChild(target);
var reference = document.createElement('div');
reference.id = referenceId;
document.body.appendChild(reference);
reference.style = '';
assert_equals(getComputedStyle(target)[settings.property], getComputedStyle(reference)[settings.property]);
}, 'Animation between "' + settings.from + '" and "' + settings.to + '" at progress ' + progress);
}
}

View file

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>rotate interpolation</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#propdef-rotate">
<meta name="assert" content="rotate supports animation.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/interpolation-testcommon.js"></script>
</head>
<body>
<script>
test_interpolation({
property: 'rotate',
from: '100deg',
to: '180deg',
}, [
{at: -1, expect: '20deg'},
{at: 0, expect: '100deg'},
{at: 0.125, expect: '110deg'},
{at: 0.875, expect: '170deg'},
{at: 1, expect: '180deg'},
{at: 2, expect: '260deg'}
]);
test_interpolation({
property: 'rotate',
from: '45deg',
to: '-1 1 0 60deg',
}, [
{at: -1, expect: '0.447214 -0.447214 0.774597 104.478deg'},
{at: 0, expect: '45deg'},
{at: 0.125, expect: '-0.136456 0.136456 0.981203 40.6037deg'},
{at: 0.875, expect: '-0.70246 0.70246 0.114452 53.1994deg'},
{at: 1, expect: '-1 1 0 60deg'},
{at: 2, expect: '-0.637897 0.637897 -0.431479 124.975deg'}
]);
test_interpolation({
property: 'rotate',
from: 'none',
to: '7 -8 9 400grad',
}, [
{at: -1, expect: '7 -8 9 -400grad'},
{at: 0, expect: 'none'},
{at: 0.125, expect: '7 -8 9 50grad'},
{at: 0.875, expect: '7 -8 9 350grad'},
{at: 1, expect: '7 -8 9 400grad'},
{at: 2, expect: '7 -8 9 800grad'}
]);
test_interpolation({
property: 'rotate',
from: 'none',
to: 'none',
}, [
{at: -1, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.125, expect: 'none'},
{at: 0.875, expect: 'none'},
{at: 1, expect: 'none'},
{at: 2, expect: 'none'}
]);
</script>
</body>
</html>

View file

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>scale interpolation</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#propdef-scale">
<meta name="assert" content="scale supports animation.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/interpolation-testcommon.js"></script>
</head>
<body>
<script>
test_interpolation({
property: 'scale',
from: '2 30 400',
to: '10 110 1200',
}, [
{at: -1, expect: '-6 -50 -400'},
{at: 0, expect: '2 30 400'},
{at: 0.125, expect: '3 40 500'},
{at: 0.875, expect: '9 100 1100'},
{at: 1, expect: '10 110 1200'},
{at: 2, expect: '18 190 2000'}
]);
test_interpolation({
property: 'scale',
from: '26 17 9',
to: '2',
}, [
{at: -1, expect: '50 33 17'},
{at: 0, expect: '26 17 9'},
{at: 0.125, expect: '23 15 8'},
{at: 0.875, expect: '5 3 2'},
{at: 1, expect: '2'},
{at: 2, expect: '-22 -15 -7'}
]);
test_interpolation({
property: 'scale',
from: 'none',
to: '4 3 2',
}, [
{at: -1, expect: '-2 -1 0'},
{at: 0, expect: 'none'},
{at: 0.125, expect: '1.375 1.25 1.125'},
{at: 0.875, expect: '3.625 2.75 1.875'},
{at: 1, expect: '4 3 2'},
{at: 2, expect: '7 5 3'}
]);
test_interpolation({
property: 'scale',
from: 'none',
to: 'none',
}, [
{at: -1, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.125, expect: 'none'},
{at: 0.875, expect: 'none'},
{at: 1, expect: 'none'},
{at: 2, expect: 'none'}
]);
</script>
</body>
</html>

View file

@ -0,0 +1,78 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>translate interpolation</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#propdef-translate">
<meta name="assert" content="translate supports <length> and <percentage> animation.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/interpolation-testcommon.js"></script>
<style>
body {
width: 500px;
height: 500px;
}
div {
width: 10px;
height: 10px;
}
</style>
</head>
<body>
<script>
test_interpolation({
property: 'translate',
from: '220px 240px 260px',
to: '300px 400px 500px',
}, [
{at: -1, expect: '140px 80px 20px'},
{at: 0, expect: '220px 240px 260px'},
{at: 0.125, expect: '230px 260px 290px'},
{at: 0.875, expect: '290px 380px 470px'},
{at: 1, expect: '300px 400px 500px'},
{at: 2, expect: '380px 560px 740px'}
]);
test_interpolation({
property: 'translate',
from: '480px 400px 320px',
to: '240% 160%',
}, [
{at: -1, expect: 'calc(960px - 240%) calc(800px - 160%) 640px'},
{at: 0, expect: '480px 400px 320px'},
{at: 0.125, expect: 'calc(420px + 30%) calc(350px + 20%) 280px'},
{at: 0.875, expect: 'calc(210% + 60px) calc(140% + 50px) 40px'},
{at: 1, expect: '240% 160%'},
{at: 2, expect: 'calc(480% - 480px) calc(320% - 400px) -320px'}
]);
test_interpolation({
property: 'translate',
from: 'none',
to: '8px 80% 800px',
}, [
{at: -1, expect: '-8px -80% -800px'},
{at: 0, expect: 'none'},
{at: 0.125, expect: '1px 10% 100px'},
{at: 0.875, expect: '7px 70% 700px'},
{at: 1, expect: '8px 80% 800px'},
{at: 2, expect: '16px 160% 1600px'}
]);
test_interpolation({
property: 'translate',
from: 'none',
to: 'none',
}, [
{at: -1, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.125, expect: 'none'},
{at: 0.875, expect: 'none'},
{at: 1, expect: 'none'},
{at: 2, expect: 'none'}
]);
</script>
</body>
</html>