[art-prep] Phase2Pictures: Add the fox, berries, bush, paths and lanterns to the art board, each card marked with its phase

This commit is contained in:
2026-11-01 21:55:04 +01:00
parent 846d082003
commit a5dbd5251b
44 changed files with 576 additions and 17 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ describe('art:accept', () => {
});
it('refuses a name that is not in the manifest, and a file that is not a picture', async () => {
expect(await refusal(acceptPicture(Buffer.from('x'), 'fox-sheet', m))).toMatch(/"fox-sheet" is not a picture/);
expect(await refusal(acceptPicture(Buffer.from('x'), 'owl-sheet', m))).toMatch(/"owl-sheet" is not a picture/);
expect(await refusal(acceptPicture(Buffer.from('not an image'), 'garden-chair', m))).toMatch(/could not be read as a picture/);
});
});
+14 -2
View File
@@ -2,7 +2,7 @@ import { readFileSync, readdirSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
import { boardData } from '../src/board.js';
import { placeholders } from '../src/placeholders.js';
import { readManifest, readStyle, root } from './fixtures.js';
import { clone, readManifest, readStyle, root } from './fixtures.js';
const manifest = readManifest();
const data = boardData(manifest, readStyle());
@@ -19,7 +19,13 @@ describe('the board data', () => {
for (const c of a.cells ?? []) expect(c).toMatchObject({ id: expect.any(String), width: expect.any(Number), height: expect.any(Number), prompt: expect.any(String) });
}
}
expect(data.checklist).toHaveLength(8);
expect(data.checklist).toHaveLength(10);
expect(data.assets.every((a) => Number.isInteger(a.phase))).toBe(true);
});
it('every card says its phase, so a Phase 3 picture is never mistaken for a Phase 1 one', () => {
expect(page).toContain('`Phase ${a.phase} · sprite sheet');
expect(page).toContain('`Phase ${a.phase} · ${a.type}');
});
it('every kind in the manifest has a group on the board page, or its cards would never show', () => {
@@ -46,6 +52,12 @@ describe('the stand-ins', () => {
expect(stand.get('watering-can')).toContain('viewBox="0 0 512 512"');
});
it('a picture with no stand-in drawing stops the build, instead of showing an empty box', () => {
const m = clone(manifest);
(m.assets.find((a) => a.id === 'lanterns-sheet')?.cells as unknown as { id: string }[])[1]!.id = 'lantern-blue';
expect(() => placeholders(m)).toThrow(/no stand-in drawing for "lantern-blue"/);
});
it('load nothing from anywhere', () => {
for (const svg of stand.values()) {
expect(svg.replace('xmlns="http://www.w3.org/2000/svg"', '')).not.toMatch(/https?:|href=|<image|<script/);
+15 -2
View File
@@ -21,10 +21,21 @@ describe('art/manifest.json', () => {
it('asks for the Phase 1 pictures: the rose sheet first, then stages, care, moments, props, chair, four garden layers, the icon', () => {
const m = readManifest();
expect(m.assets[0]?.id).toBe('rose-sheet');
const pictures = m.assets.flatMap((a: Asset) => (a.cells ? a.cells.map((c) => c.id) : [a.id]));
const phase1 = m.assets.filter((a) => a.phase === 1);
const pictures = phase1.flatMap((a: Asset) => (a.cells ? a.cells.map((c) => c.id) : [a.id]));
expect(pictures).toHaveLength(25);
expect(pictures).toEqual(expect.arrayContaining(['rose-bud', 'rose-full-bloom', 'rose-waiting', 'petal-folded', 'garden-chair', 'garden-sunset', 'garden-night', 'app-icon']));
});
it('then Phase 2, the fox sheet first, and the decided Phase 3 pictures: 28 more', () => {
const m = readManifest();
const later = m.assets.filter((a) => a.phase > 1);
expect(later[0]?.id).toBe('fox-sheet');
const pictures = later.flatMap((a: Asset) => (a.cells ? a.cells.map((c) => c.id) : [a.id]));
expect(pictures).toHaveLength(28);
expect(pictures).toEqual(expect.arrayContaining(['fox-watching', 'fox-petted', 'fox-asleep', 'rose-hips', 'bush-ripe', 'fox-brush', 'path-road', 'lantern-lit']));
expect(new Set(m.assets.map((a) => a.phase))).toEqual(new Set([1, 2, 3]));
});
});
describe('checkManifest refuses', () => {
@@ -36,10 +47,12 @@ describe('checkManifest refuses', () => {
['a grid whose cells do not match', withAsset('rose-stages-sheet', (a) => { a.grid = { cols: 3, rows: 1 }; }), /4 cells for a 3 × 1 grid/],
['a grid that does not divide the sheet', withAsset('care-props-sheet', (a) => { a.grid = { cols: 3, rows: 3 }; (a.cells as unknown[]).push({ id: 'x-1', does: 'x' }, { id: 'x-2', does: 'x' }, { id: 'x-3', does: 'x' }); }), /does not divide/],
['a grid on a single picture', withAsset('garden-chair', (a) => { a.grid = { cols: 1, rows: 1 }; }), /only a sprite sheet/],
['an unknown character', withAsset('app-icon', (a) => { a.character = 'fox'; }), /unknown character "fox"/],
['an unknown character', withAsset('app-icon', (a) => { a.character = 'owl'; }), /unknown character "owl"/],
['a shipped character sheet', withAsset('rose-sheet', (a) => { a.shipped = true; }), /never shipped/],
['a sprite on a full background', withAsset('garden-chair', (a) => { a.background = 'full'; }), /must be transparent/],
['a review point STYLE.md §7 does not have', withAsset('garden-chair', (a) => { a.checks = [0, POINTS]; }), new RegExp(`review point ${POINTS} is not in`)],
['a phase the roadmap does not have', withAsset('garden-chair', (a) => { a.phase = 0; }), /phase 0 is not a roadmap phase/],
['a Phase 1 picture listed after Phase 3', withAsset('lanterns-sheet', (a) => { a.phase = 1; }), /lanterns-sheet: phase 1 comes after phase 3; list the pictures in phase order/],
['a picture with no subject', withAsset('garden-chair', (a) => { delete a.subject; }), /no subject/],
['a picture nobody uses', withAsset('garden-chair', (a) => { a.usedBy = []; }), /usedBy is empty/],
['a name from the book in a prompt', withAsset('garden-chair', (a) => { a.subject = 'a chair for the Little Prince'; }), /"Little Prince" \(little-prince\)/],
+19 -4
View File
@@ -17,9 +17,10 @@ describe('STYLE.md', () => {
expect(style.endsWith('book, illustrator or film.')).toBe(true);
});
it('§7 has the eight review points, a point split over two lines read as one', () => {
it('§7 has the ten review points, a point split over two lines read as one', () => {
const points = reviewPoints(readStyle());
expect(points).toHaveLength(8);
expect(points).toHaveLength(10);
expect(points[8]).toBe("It reads as one young russet fox with a cream mask and a ringed tail, shy and gentle, and nothing like the book's sandy, long-eared fox.");
expect(points[3]).toBe('Nothing from the book: no glass dome, screen, tiny planet, desert, child or scarf, and no look of its drawings.');
});
@@ -30,8 +31,8 @@ describe('STYLE.md', () => {
});
describe('the prompts', () => {
it('every one starts with STYLE.md §1 word for word: 11 cards and 18 one-at-a-time prompts', () => {
expect(allPrompts).toHaveLength(11 + 18);
it('every one starts with STYLE.md §1 word for word: 18 cards and 45 one-at-a-time prompts', () => {
expect(allPrompts).toHaveLength(18 + 45);
for (const p of allPrompts) expect(p.startsWith(style + '\n\nAsset: ')).toBe(true);
});
@@ -54,6 +55,20 @@ describe('the prompts', () => {
expect(by.get('care-props-sheet')?.attach).toEqual([]);
});
it('a fox picture asks for the fox sheet, never the rose sheet, and every one-at-a-time fox prompt does too', () => {
const by = new Map(data.assets.map((a) => [a.id, a]));
expect(by.get('fox-sheet')?.attach).toEqual([]);
for (const id of ['fox-trust-sheet', 'fox-moments-sheet']) {
const a = by.get(id);
expect(a?.attach).toEqual(['fox-sheet']);
for (const p of [a?.prompt ?? '', ...(a?.cells ?? []).map((c) => c.prompt)]) {
expect(p).toContain('Attach the character sheet fox-sheet as the reference picture');
expect(p).not.toContain('rose-sheet');
}
}
for (const id of ['berries-sheet', 'berry-bush-sheet', 'paths-sheet', 'lanterns-sheet']) expect(by.get(id)?.attach).toEqual([]);
});
it('a manifest with a forbidden name never reaches the board', () => {
const m = clone(readManifest());
(m.assets[1] as { purpose: string }).purpose = 'In the style of Saint-Exupéry';