mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 00:27:01 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Has been cancelled
Python tests / test (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Shell tests / shell-tests (push) Has been cancelled
Shell tests / lib-tests (push) Has been cancelled
Shell tests / arch-tests (push) Has been cancelled
- fit.py: centre each glyph and scale it so its furthest ink sits at INK_RADIUS = 340px, compensating the unscaled stroke width - style.py: INK_RADIUS plus INK_RADIUS_DP for vector-drawable consumers - labels.py/_label_widths.py: LABELS registry; names start with a capital, ASCII letters only, <= 10 chars, <= 522 wide in the Pixel launcher font - drop centre_offset, safe_box_overflow and the CLI safe-box warning - add prompt-bubble (sufler) and camera (macro_cam) glyphs and apps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012kQ5PCKqBHAkAVkPSvp6dk
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
"""Tests for app_icons.preview."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
from python_pkg.app_icons import preview, render
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
MOD = "python_pkg.app_icons.preview"
|
|
|
|
|
|
class TestBuildContactSheet:
|
|
@patch(f"{MOD}.subprocess.run")
|
|
@patch(f"{MOD}.render.rasterise")
|
|
@patch(f"{MOD}.fit.placement", return_value=render.IDENTITY)
|
|
@patch(f"{MOD}.render.resolve_tool", return_value="/usr/bin/magick")
|
|
def test_renders_one_tile_per_app_and_three_rows(
|
|
self,
|
|
mock_tool: MagicMock,
|
|
mock_offset: MagicMock,
|
|
raster: MagicMock,
|
|
run: MagicMock,
|
|
tmp_path: Path,
|
|
) -> None:
|
|
destination = tmp_path / "out" / "sheet.png"
|
|
assert preview.build_contact_sheet(["todo", "workout_app"], destination) == (
|
|
destination
|
|
)
|
|
assert raster.call_count == 2
|
|
# per app: circle mask + downscale; then 3 row montages + 1 append.
|
|
assert run.call_count == 2 * 2 + 3 + 1
|
|
assert destination.parent.is_dir()
|
|
|
|
@patch(f"{MOD}.subprocess.run")
|
|
@patch(f"{MOD}.render.rasterise")
|
|
@patch(f"{MOD}.fit.placement", return_value=render.IDENTITY)
|
|
@patch(f"{MOD}.render.resolve_tool", return_value="/usr/bin/magick")
|
|
def test_final_append_is_vertical(
|
|
self,
|
|
mock_tool: MagicMock,
|
|
mock_offset: MagicMock,
|
|
mock_raster: MagicMock,
|
|
run: MagicMock,
|
|
tmp_path: Path,
|
|
) -> None:
|
|
preview.build_contact_sheet(["todo"], tmp_path / "sheet.png")
|
|
assert "-append" in run.call_args.args[0]
|