feat: add CHRNX podcast grunge background
This commit is contained in:
3 files changed
+63
-1
No files matched your search
@@ -17,6 +17,7 @@ ALTER_EGO_ASSETS = (
|
||||
"alter-ego-gaming.png",
|
||||
)
|
||||
ALTER_EGO_SOURCE_ASSETS = (*ALTER_EGO_ASSETS, "alter-ego-gaming-half-body.png")
|
||||
BACKGROUND_ASSETS = ("podcast-frequency-grunge.png",)
|
||||
CONTACT_SHEET_SCRIPT = PROJECT_ROOT / "scripts" / "build-alter-ego-contact-sheet.py"
|
||||
|
||||
|
||||
@@ -93,6 +94,42 @@ def test_alter_ego_asset_inventory_and_image_contract() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_background_asset_inventory_and_image_contract() -> None:
|
||||
assert BACKGROUND_ASSETS == ("podcast-frequency-grunge.png",)
|
||||
|
||||
missing = [
|
||||
name for name in BACKGROUND_ASSETS if not (ASSET_DIRECTORY / name).is_file()
|
||||
]
|
||||
assert not missing, "Background asset inventory mismatch:\n" + "\n".join(
|
||||
f"- missing assets/images/{name}" for name in missing
|
||||
)
|
||||
|
||||
violations: list[str] = []
|
||||
for name in BACKGROUND_ASSETS:
|
||||
path = ASSET_DIRECTORY / name
|
||||
with Image.open(path) as image:
|
||||
if image.format != "PNG":
|
||||
violations.append(f"{name}: expected PNG, got {image.format!r}")
|
||||
if image.mode not in {"RGB", "RGBA"}:
|
||||
violations.append(f"{name}: expected RGB or RGBA, got {image.mode!r}")
|
||||
|
||||
width, height = image.size
|
||||
if width < 1536 or height < 960:
|
||||
violations.append(
|
||||
f"{name}: expected at least 1536x960, got {width}x{height}"
|
||||
)
|
||||
|
||||
aspect_ratio = width / height
|
||||
if not 1.35 <= aspect_ratio <= 1.7:
|
||||
violations.append(
|
||||
f"{name}: aspect ratio {aspect_ratio:.4f} outside 1.35..1.7"
|
||||
)
|
||||
|
||||
assert not violations, "Background asset contract violations:\n" + "\n".join(
|
||||
f"- {violation}" for violation in violations
|
||||
)
|
||||
|
||||
|
||||
def test_gaming_half_body_preserves_original_and_has_prominent_visible_alpha() -> None:
|
||||
original = ASSET_DIRECTORY / "alter-ego-gaming.png"
|
||||
half_body = ASSET_DIRECTORY / "alter-ego-gaming-half-body.png"
|
||||
|
||||
Reference in new issue
Block a user