1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
<!DOCTYPE html>
<meta charset="UTF-8">
<title>font-size composition</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
:root {
font-size: 30px;
}
.parent {
font-size: 20px;
}
</style>
<body>
<script>
test_composition({
property: 'font-size',
underlying: '50px',
addFrom: '100px',
addTo: '200px',
}, [
{at: -0.3, expect: '120px'},
{at: 0, expect: '150px'},
{at: 0.25, expect: '175px'},
{at: 0.5, expect: '200px'},
{at: 0.75, expect: '225px'},
{at: 1, expect: '250px'},
{at: 1.5, expect: '300px'},
]);
test_composition({
property: 'font-size',
underlying: '100px',
addFrom: '10px',
addTo: 'large',
}, [
{at: -0.5, expect: '106px'},
{at: 0, expect: '110px'},
{at: 0.25, expect: '112px'},
{at: 0.5, expect: '114px'},
{at: 0.75, expect: '116px'},
{at: 1, expect: '118px'},
{at: 1.5, expect: '122px'},
]);
test_composition({
property: 'font-size',
underlying: '50%',
addFrom: 'small',
addTo: '20px',
}, [
{at: -0.3, expect: '20.9px'},
{at: 0, expect: '23px'},
{at: 0.25, expect: '24.75px'},
{at: 0.5, expect: '26.5px'},
{at: 0.75, expect: '28.25px'},
{at: 1, expect: '30px'},
{at: 1.5, expect: '33.5px'},
]);
test_composition({
property: 'font-size',
underlying: '20%',
addFrom: '10rem',
replaceTo: '5em',
}, [
{at: -0.3, expect: '365.2px'},
{at: 0, expect: '304px'},
{at: 0.25, expect: '253px'},
{at: 0.5, expect: '202px'},
{at: 0.75, expect: '151px'},
{at: 1, expect: '100px'},
{at: 1.5, expect: '0px'},
]);
test_composition({
property: 'font-size',
underlying: 'small',
replaceFrom: 'medium',
addTo: 'larger',
}, [
{at: -0.3, expect: '9.7px'},
{at: 0, expect: '16px'},
{at: 0.25, expect: '21.25px'},
{at: 0.5, expect: '26.5px'},
{at: 0.75, expect: '31.75px'},
{at: 1, expect: '37px'},
{at: 1.5, expect: '47.5px'},
]);
</script>
</body>
|