Files
FinalToken/tools/icon/test_make_icon.py
T
schmidt.florian c02829e2e1 app: let the settings hide limit windows and give the app an icon (#18)
The developer asked for an option to hide Claude's Fable week and for an
app icon that Windows can use (2026-11-04).

- Core: each provider's settings hold hidden limit windows by window
  series, so a hidden Codex week stays hidden across slot moves (D7, D8).
  Older settings files load with nothing hidden. Hidden windows give no
  pace popups.
- App: Settings → Providers lists each provider's limit windows with a
  Show checkbox, including hidden windows that are absent right now. The
  panel drops hidden windows in one place before it renders and queries
  history; the snapshot and history keep every window (D9).
- App: a usage gauge in the provider colours is the executable's icon,
  the window icon and the tray icon. tools/icon/make_icon.py renders it
  with Pillow, a development-only dependency, into a multi-size ICO and a
  PNG.

Closes #17
2026-11-04 19:41:44 +01:00

31 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Check all ICO frames and reproducible committed icon assets."""
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
from PIL import Image
from make_icon import ASSETS, SIZES, render
class IconTests(unittest.TestCase):
def test_ico_contains_every_size_and_its_rendered_pixels(self):
with Image.open(ASSETS / 'FinalToken.ico') as icon:
self.assertEqual({(s, s) for s in SIZES}, icon.ico.sizes())
for size in SIZES:
frame = icon.ico.getimage((size, size))
self.assertEqual(render(size).tobytes(), frame.tobytes())
def test_fresh_run_reproduces_committed_files_byte_for_byte(self):
with tempfile.TemporaryDirectory() as temporary:
subprocess.run([sys.executable, '-B', str(Path(__file__).with_name('make_icon.py')),
'--out', temporary], check=True)
for name in ('FinalToken.ico', 'FinalToken.png'):
self.assertEqual((ASSETS / name).read_bytes(), (Path(temporary) / name).read_bytes(), name)
if __name__ == '__main__':
unittest.main()