1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:47:35 +00:00

Base: Add more test cases to fonts.html

- More combinations of values
- Testing a font (Liberation Serif) which has multiple faces
- Add calc() tests for font-size and weight
- Check fallback when a font isn't available

While I was at it, reorganized the file so the CSS is inline - this
keeps it close to the relevant test case.
This commit is contained in:
Sam Atkins 2021-08-14 17:41:57 +01:00 committed by Andreas Kling
parent e11d177618
commit 7106655c86

View file

@ -1,32 +1,58 @@
<!doctype html>
<html>
<head>
<title>CSS test</title>
<title>CSS Fonts test</title>
<style type="text/css">
#monospace { font: 20px monospace; }
#a { font: 12pt/14pt sans-serif; }
#b { font: 80% cursive; }
#b2 { font: bold 80% cursive; }
#c { font: x-large/110% fantasy, serif; }
#d { font: 2em SerenitySans; }
#d2 { font: 400 2em SerenitySans; }
#e { font: bold italic large Helvetica, sans-serif; }
#f { font: normal small-caps 120%/120% monospace; }
#g { font: condensed oblique 12pt "Helvetica Neue", serif; }
#h { font: condensed oblique 25deg 12pt "Helvetica Neue", serif; }
h2 {
font-family: sans-serif;
}
section {
border: 1px solid black;
border-radius: 8px;
padding: 1em;
margin: 1em;
}
</style>
</head>
<body>
<div id="monospace">font: 20px monospace;</div>
<div id="a">font: 12pt/14pt sans-serif;</div>
<div id="b">font: 80% cursive;</div>
<div id="b2">font: bold 80% cursive;</div>
<div id="c">font: x-large/110% fantasy, serif;</div>
<div id="d">font: 2em SerenitySans;</div>
<div id="d2">font: 400 2em SerenitySans;</div>
<div id="e">font: bold italic large Helvetica, sans-serif;</div>
<div id="f">font: normal small-caps 120%/120% monospace;</div>
<div id="g">font: condensed oblique 12pt "Helvetica Neue", serif;</div>
<div id="h">font: condensed oblique 25deg 12pt "Helvetica Neue", serif;</div>
<h2>General tests</h2>
<section>
<p style="font: 20px monospace;">font: 20px monospace;</p>
<p style="font: 12pt/14pt sans-serif;">font: 12pt/14pt sans-serif;</p>
<p style="font: 80% cursive;">font: 80% cursive;</p>
<p style="font: bold 80% cursive;">font: bold 80% cursive;</p>
<p style="font: x-large/110% fantasy, serif;">font: x-large/110% fantasy, serif;</p>
<p style="font: 400 2em SerenitySans;">font: 400 2em SerenitySans;</p>
<p style="font: 400 200% SerenitySans;">font: 400 200% SerenitySans;</p>
<p style="font: 400 x-large SerenitySans;">font: 400 x-large SerenitySans;</p>
<p style="font: smaller SerenitySans;">font: smaller SerenitySans;</p>
<p style="font: normal smaller SerenitySans;">font: normal smaller SerenitySans;</p>
<p style="font: bold italic large Helvetica, sans-serif;">font: bold italic large Helvetica, sans-serif;</p>
<p style="font: normal small-caps 120%/120% monospace;">font: normal small-caps 120%/120% monospace;</p>
<p style="font: condensed oblique 12pt 'Helvetica Neue', serif;">font: condensed oblique 12pt "Helvetica Neue", serif;</p>
<p style="font: condensed oblique 25deg 12pt 'Helvetica Neue', serif;">font: condensed oblique 25deg 12pt "Helvetica Neue", serif;</p>
</section>
<h2>Calc() values</h2>
<section>
<p style="font-family: 'Liberation Serif', cursive; font-size: calc(120% + 10px);">font-family: 'Liberation Serif', cursive; font-size: calc(120% + 10px);</p>
<p style="font: calc(120% + 10px) 'Liberation Serif', cursive;">font: calc(120% + 10px) 'Liberation Serif', cursive;</p>
<p style="font-family: 'Liberation Serif', cursive; font-weight: calc(200 * 4);">font-family: 'Liberation Serif', cursive; font-weight: calc(200 * 4);</p>
<p style="font: calc(200*4) 20px 'Liberation Serif', cursive;">font: calc(200 * 4) 20px 'Liberation Serif', cursive;</p>
</section>
<h2>Fallback</h2>
<section>
<p style="font: 16pt 'fake font', not-real-font, 'SerenitySans', monospace;">font: 16pt 'fake font', not-real-font, 'SerenitySans', monospace;</p>
<p style="font-family: 'fake font', not-real-font, 'SerenitySans', monospace;">font-family: 'fake font', not-real-font, 'SerenitySans', monospace;</p>
</section>
<h2>Fonts with multiple faces</h2>
<section>
<p style="font: 20px 'Liberation Serif';">font: 20px 'Liberation Serif';</p>
<p style="font: italic 20px 'Liberation Serif';">font: italic 20px 'Liberation Serif';</p>
<p style="font: bold 20px 'Liberation Serif';">font: bold 20px 'Liberation Serif';</p>
<p style="font: bold italic 20px 'Liberation Serif';">font: bold italic 20px 'Liberation Serif';</p>
</section>
</body>
</html>