blob: 42c3504e9723235dafcdf5f1b894110e4fdefb88 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
--resolution-list: 30dppx 300dppx;
}
.target {
--resolution-list: 10dppx 100dppx;
}
</style>
<body>
<script src="../interpolation/resources/interpolation-test.js"></script>
<script>
CSS.registerProperty({
name: '--resolution-list',
syntax: '<resolution>+',
initialValue: '40dppx 400dppx',
inherits: false,
});
assertInterpolation({
property: '--resolution-list',
from: 'initial',
to: '20dppx 200dppx',
}, [
{at: -0.3, is: '46dppx 460dppx'},
{at: 0, is: '40dppx 400dppx'},
{at: 0.5, is: '30dppx 300dppx'},
{at: 1, is: '20dppx 200dppx'},
{at: 1.5, is: '10dppx 100dppx'},
]);
assertInterpolation({
property: '--resolution-list',
from: 'inherit',
to: '20dppx 200dppx',
}, [
{at: -0.3, is: '33dppx 330dppx'},
{at: 0, is: '30dppx 300dppx'},
{at: 0.5, is: '25dppx 250dppx'},
{at: 1, is: '20dppx 200dppx'},
{at: 1.5, is: '15dppx 150dppx'},
]);
assertInterpolation({
property: '--resolution-list',
from: 'unset',
to: '20dppx 200dppx',
}, [
{at: -0.3, is: '46dppx 460dppx'},
{at: 0, is: '40dppx 400dppx'},
{at: 0.5, is: '30dppx 300dppx'},
{at: 1, is: '20dppx 200dppx'},
{at: 1.5, is: '10dppx 100dppx'},
]);
assertInterpolation({
property: '--resolution-list',
from: '-10dppx -100dppx',
to: '10dppx 100dppx',
}, [
{at: -0.3, is: '-16dppx -160dppx'},
{at: 0, is: '-10dppx -100dppx'},
{at: 0.5, is: '0dppx 0dppx'},
{at: 1, is: '10dppx 100dppx'},
{at: 1.5, is: '20dppx 200dppx'}
]);
assertInterpolation({
property: '--resolution-list',
from: '10dppx',
to: '100dppx',
}, [
{at: -0.3, is: '-17dppx'},
{at: 0, is: '10dppx'},
{at: 0.5, is: '55dppx'},
{at: 1, is: '100dppx'},
{at: 1.5, is: '145dppx'}
]);
assertInterpolation({
property: '--resolution-list',
from: '96dpi 192dpi',
to: '2dppx 2dppx',
}, [
{at: -0.3, is: '0.7dppx 2dppx'},
{at: 0, is: '1dppx 2dppx'},
{at: 0.5, is: '1.5dppx 2dppx'},
{at: 1, is: '2dppx 2dppx'},
{at: 1.5, is: '2.5dppx 2dppx'}
]);
// Composition and neutralKeyframe tests assume that composite:add means
// component-wise addition, which may or may not be the behavior we want.
// https://github.com/w3c/css-houdini-drafts/issues/799
assertInterpolation({
property: '--resolution-list',
from: neutralKeyframe,
to: '20dppx 200dppx',
}, [
{at: -0.3, is: '7dppx 70dppx'},
{at: 0, is: '10dppx 100dppx'},
{at: 0.5, is: '15dppx 150dppx'},
{at: 1, is: '20dppx 200dppx'},
{at: 1.5, is: '25dppx 250dppx'},
]);
assertComposition({
property: '--resolution-list',
underlying: '50dppx 60dppx',
addFrom: '10dppx 140dppx',
addTo: '110dppx 40dppx',
}, [
{at: -0.3, is: '30dppx 230dppx'},
{at: 0, is: '60dppx 200dppx'},
{at: 0.5, is: '110dppx 150dppx'},
{at: 1, is: '160dppx 100dppx'},
{at: 1.5, is: '210dppx 50dppx'},
]);
assertComposition({
property: '--resolution-list',
underlying: '50dppx 60dppx',
addFrom: '10dppx 140dppx',
replaceTo: '110dppx 40dppx',
}, [
{at: -0.3, is: '45dppx 248dppx'},
{at: 0, is: '60dppx 200dppx'},
{at: 0.5, is: '85dppx 120dppx'},
{at: 1, is: '110dppx 40dppx'},
{at: 1.5, is: '135dppx -40dppx'},
]);
</script>
</body>