app: give the app one icon for the executable, windows and tray
Windows showed the default executable icon, and the tray drew a plain "T" at run time. A usage gauge in the provider colours now serves all three (D8). tools/icon/make_icon.py renders it with Pillow, a development-only dependency, into a multi-size ICO for Windows and a PNG for X11. Its test checks every size and that a fresh run reproduces the committed files. Refs #17
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user