"""Tests for tools/make_icon.py (launcher icon generator).""" from __future__ import annotations import make_icon from PIL import Image def rgba(img: Image.Image, xy: tuple[int, int]) -> tuple[int, ...]: """One RGBA pixel as a tuple (Pillow's getpixel returns a wider union type).""" value = img.getpixel(xy) assert isinstance(value, tuple) return value def test_icon_size_transparency_and_colours() -> None: img = make_icon.draw_icon(60) assert img.size == (60, 60) assert img.mode == "RGBA" # Corners are outside the disc, so fully transparent. assert rgba(img, (0, 0))[3] == 0 # The disc edge is teal, the lock body in the middle is white. r, g, b, a = rgba(img, (30, 4)) assert a > 200 and g > r and b > r assert rgba(img, (22, 40))[:3] == (255, 255, 255)