fix: promote approved Gaming character art
This commit is contained in:
13 files changed
+153
-13
No files matched your search
@@ -16,6 +16,7 @@ ALTER_EGO_ASSETS = (
|
||||
"alter-ego-life.png",
|
||||
"alter-ego-gaming.png",
|
||||
)
|
||||
ALTER_EGO_SOURCE_ASSETS = (*ALTER_EGO_ASSETS, "alter-ego-gaming-half-body.png")
|
||||
CONTACT_SHEET_SCRIPT = PROJECT_ROOT / "scripts" / "build-alter-ego-contact-sheet.py"
|
||||
|
||||
|
||||
@@ -33,9 +34,9 @@ def test_opaque_coverage_counts_near_opaque_alpha() -> None:
|
||||
|
||||
|
||||
def test_alter_ego_asset_inventory_and_image_contract() -> None:
|
||||
expected = set(ALTER_EGO_ASSETS)
|
||||
expected = set(ALTER_EGO_SOURCE_ASSETS)
|
||||
actual = {path.name for path in ASSET_DIRECTORY.glob("alter-ego-*.png")}
|
||||
missing = [name for name in ALTER_EGO_ASSETS if name not in actual]
|
||||
missing = [name for name in ALTER_EGO_SOURCE_ASSETS if name not in actual]
|
||||
unexpected = sorted(actual - expected)
|
||||
inventory_violations = [
|
||||
*(f"missing assets/images/{name}" for name in missing),
|
||||
@@ -46,7 +47,7 @@ def test_alter_ego_asset_inventory_and_image_contract() -> None:
|
||||
)
|
||||
|
||||
violations: list[str] = []
|
||||
for name in ALTER_EGO_ASSETS:
|
||||
for name in ALTER_EGO_SOURCE_ASSETS:
|
||||
path = ASSET_DIRECTORY / name
|
||||
with Image.open(path) as image:
|
||||
if image.format != "PNG":
|
||||
@@ -92,6 +93,24 @@ def test_alter_ego_asset_inventory_and_image_contract() -> None:
|
||||
)
|
||||
|
||||
|
||||
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"
|
||||
assert original.read_bytes() != half_body.read_bytes()
|
||||
|
||||
with Image.open(original) as original_image, Image.open(half_body) as half_body_image:
|
||||
assert original_image.size == half_body_image.size == (1024, 1536)
|
||||
original_box = original_image.getchannel("A").point(
|
||||
lambda value: 255 if value >= 16 else 0
|
||||
).getbbox()
|
||||
half_body_box = half_body_image.getchannel("A").point(
|
||||
lambda value: 255 if value >= 16 else 0
|
||||
).getbbox()
|
||||
assert original_box == (170, 54, 882, 1475)
|
||||
assert half_body_box == (15, 79, 948, 1536)
|
||||
assert (half_body_box[2] - half_body_box[0]) / 1024 >= 0.90
|
||||
|
||||
|
||||
def _install_contact_sheet_script(project_root: Path) -> Path:
|
||||
assert CONTACT_SHEET_SCRIPT.is_file(), (
|
||||
f"Missing contact-sheet script: {CONTACT_SHEET_SCRIPT}"
|
||||
|
||||
Reference in new issue
Block a user