feat: add CHRNX podcast grunge background

This commit is contained in:
chrnx committed 2026-08-13 00:40:39 -05:00
1 parent 7480f9c21e
commit a537196525
3 files changed
+63 -1

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

+37
View File
@@ -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"
+26 -1
View File
@@ -1,11 +1,12 @@
import assert from 'node:assert/strict';
import { mkdtempSync, readFileSync, readdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { test } from 'node:test';
const read = ( path ) => readFileSync( new URL( `../../${ path }`, import.meta.url ), 'utf8' );
const PODCAST_BACKGROUND_SOURCE = 'assets/images/podcast-frequency-grunge.png';
test( 'local visual fixtures define stable pages and representative editorial states', () => {
const pages = JSON.parse( read( 'tests/fixtures/pages.json' ) );
@@ -242,6 +243,30 @@ test( 'post-card CSS fallbacks never reuse approved section portraits', () => {
assert.doesNotMatch( components, /url\([^)]*(?:alter-ego-|the-no-names-musician-cutout)/ );
} );
test( 'podcast background source stays separate from portrait and card fallbacks', () => {
assert.ok(
existsSync( new URL( `../../${ PODCAST_BACKGROUND_SOURCE }`, import.meta.url ) ),
`missing ${ PODCAST_BACKGROUND_SOURCE }`,
);
const portraitAllowlist = read( 'inc/queries.php' );
assert.doesNotMatch( portraitAllowlist, /podcast-frequency-grunge\.png/ );
for ( const path of [
'assets/css/components.css',
'blocks/featured-stories/style.css',
'blocks/journal-stream/style.css',
'blocks/latest-podcast/style.css',
'blocks/related-posts/style.css',
] ) {
assert.doesNotMatch(
read( path ),
/podcast-frequency-grunge\.png/,
`${ PODCAST_BACKGROUND_SOURCE } must not become a card fallback in ${ path }`,
);
}
} );
test( 'front page and section pages connect the real editorial patterns', () => {
const front = read( 'templates/front-page.html' );
assert.match( front, /chrnx\/home-intro/ );