diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:50 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:50 +0100 |
| commit | 6b03740a8c9fb98b788549412f0ebf3cbae1d2de (patch) | |
| tree | 85f9532f1efdc63ecebb9c42a3e7a3c0b764e5d3 /tests/test_theme.py | |
| parent | 4bc6d69fc0fbfc3de5fb84874985a26deb79fdb5 (diff) | |
| download | deck-it-6b03740a8c9fb98b788549412f0ebf3cbae1d2de.tar.gz deck-it-6b03740a8c9fb98b788549412f0ebf3cbae1d2de.zip | |
feat(tablet): clock fonts and sizes from keystone's Fonts page
The dim cover's time and date fonts move out of [tablet] clock_font and
clock_font_date into keystone's fonts.json: "family" deckit-clock and
deckit-date, each served at /fonts/<key>, and the "override" sizes
deckit:clock and deckit:date (else deck.css's 8rem and 1.6rem). The date
can now have a font of its own. theme.css carries the rules, so a save
on the Fonts page reaches an open tablet page within 5s, with no restart
and no flags in the tablet state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_theme.py')
| -rw-r--r-- | tests/test_theme.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_theme.py b/tests/test_theme.py index f14b0f1..1c79370 100644 --- a/tests/test_theme.py +++ b/tests/test_theme.py @@ -61,6 +61,22 @@ class Theme(unittest.TestCase): for bad in ('{"base": 99}', '{"base": "16"}', "not json", "[]"): self.assertIsNone(theme.parse_font_size(bad)) + def test_clock_fonts_from_fonts_json(self): + fams = theme.parse_families('{"base": 16, "family": {"deckit-date": " a Tag ", "deckit-clock": "", "qt": "x"}}') + self.assertEqual(fams, {"deckit-date": "a Tag"}) + for bad in ("", "nope", '{"family": "x"}', "[]"): + self.assertEqual(theme.parse_families(bad), {}) + out = theme.css({}, None, fams=fams) + self.assertIn('src: url("/fonts/deckit-date?f=a%20Tag")', out) + self.assertIn("#dimmer .dim-date", out) + self.assertNotIn("dim-time", out) + + def test_clock_sizes_from_fonts_json(self): + sizes = theme.parse_clock_sizes('{"override": {"deckit:clock": 180.4, "deckit:date": 2, "deckit": 18}}') + self.assertEqual(sizes, {".dim-time": 180}) # 2px is out of range + self.assertEqual(theme.parse_clock_sizes("nope"), {}) + self.assertIn("#dimmer .dim-time { font-size: 180px; }", theme.css({}, None, clock_sizes=sizes)) + def test_css_exposes_font_size(self): self.assertIn("--udt-font-size: 17px", theme.css({}, None, font_size=17)) self.assertIn(f"--udt-font-size: {theme.FONT_SIZE}px", theme.css({}, None)) |
