Dentro la Pieve in penombra con le candele accese che tremolano; al tennis della chiesa si entra solo dal cancello verde

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
2026-10-24 22:16:50 +02:00
co-authored by Claude Opus 5.5
parent 59c8419958
commit 10f15e69c1
3 changed files with 48 additions and 8 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { loadBackground, hasBackground, RETRIES, RETRY_WAIT } from '../src/engine/render.js';
import { loadBackground, hasBackground, RETRIES, RETRY_WAIT, flameFrame } from '../src/engine/render.js';
// Un Image finto: fallisce le prime `fails` volte per ogni indirizzo, e conta le richieste.
function fakeImage(fails) {
@@ -56,3 +56,12 @@ test('i nomi del «?» non si sovrappongono, in nessuna scena', async () => {
}
}
});
test('le candele tremolano: due disegni che si alternano a caso, non tutte insieme, e stanno dentro la scena', async () => {
const { story } = await import('../src/story/story.js');
const frames = Array.from({ length: 60 }, (_, k) => [0, 1, 2].map(i => flameFrame(k * 140, i)));
for (const i of [0, 1, 2]) assert.deepEqual(new Set(frames.map(f => f[i])), new Set([0, 1]), `la candela ${i} non cambia mai`);
assert.ok(frames.some(f => new Set(f).size > 1), 'le fiamme cambiano tutte insieme');
for (const [id, sc] of Object.entries(story.scenes)) for (const { at: [x, y] } of sc.lights ?? [])
assert.ok(x >= 0 && x < 640 && y >= 4 && y < 360, `${id}: candela fuori scena`);
});