Skip to content

Commit d29bb34

Browse files
Fredrik Söderquistchromium-wpt-export-bot
authored andcommitted
Move animations/composition/font-*-composition.html to WPT
Move the tests and perform a mechanical rewrite: * Change assertComposition() to test_composition(). * Change 'is' to 'expect' in the expectation objects. * Include required testharness.js and framework. * Add links to spec. Bug: 4066383 Change-Id: Id48b2c2f715a27340301b2f06504e3da5df062ac Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7185645 Auto-Submit: Fredrik Söderquist <[email protected]> Commit-Queue: Kevin Ellis <[email protected]> Reviewed-by: Kevin Ellis <[email protected]> Cr-Commit-Position: refs/heads/main@{#1548519}
1 parent 02dad62 commit d29bb34

File tree

2 files changed

+129
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)