1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:57: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> <!doctype html>
<html> <html>
<head> <head>
<title>CSS test</title> <title>CSS Fonts test</title>
<style type="text/css"> <style type="text/css">
#monospace { font: 20px monospace; } h2 {
#a { font: 12pt/14pt sans-serif; } font-family: sans-serif;
#b { font: 80% cursive; } }
#b2 { font: bold 80% cursive; } section {
#c { font: x-large/110% fantasy, serif; } border: 1px solid black;
#d { font: 2em SerenitySans; } border-radius: 8px;
#d2 { font: 400 2em SerenitySans; } padding: 1em;
#e { font: bold italic large Helvetica, sans-serif; } margin: 1em;
#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; }
</style> </style>
</head> </head>
<body> <body>
<div id="monospace">font: 20px monospace;</div> <h2>General tests</h2>
<div id="a">font: 12pt/14pt sans-serif;</div> <section>
<div id="b">font: 80% cursive;</div> <p style="font: 20px monospace;">font: 20px monospace;</p>
<div id="b2">font: bold 80% cursive;</div> <p style="font: 12pt/14pt sans-serif;">font: 12pt/14pt sans-serif;</p>
<div id="c">font: x-large/110% fantasy, serif;</div> <p style="font: 80% cursive;">font: 80% cursive;</p>
<div id="d">font: 2em SerenitySans;</div> <p style="font: bold 80% cursive;">font: bold 80% cursive;</p>
<div id="d2">font: 400 2em SerenitySans;</div> <p style="font: x-large/110% fantasy, serif;">font: x-large/110% fantasy, serif;</p>
<div id="e">font: bold italic large Helvetica, sans-serif;</div> <p style="font: 400 2em SerenitySans;">font: 400 2em SerenitySans;</p>
<div id="f">font: normal small-caps 120%/120% monospace;</div> <p style="font: 400 200% SerenitySans;">font: 400 200% SerenitySans;</p>
<div id="g">font: condensed oblique 12pt "Helvetica Neue", serif;</div> <p style="font: 400 x-large SerenitySans;">font: 400 x-large SerenitySans;</p>
<div id="h">font: condensed oblique 25deg 12pt "Helvetica Neue", serif;</div> <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> </body>
</html> </html>