1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# Author: cirakg & claude ai
# Summary: Tests for tools/make_icon.py, the launcher icon generator.
"""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)
|