[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
+3 -3
View File
@@ -228,7 +228,7 @@
<h1>Art board</h1>
<p class="lede">Every picture %PRODUCT_NAME% needs, with the prompt that makes it. The app shows a simple stand-in for each until a picture here is accepted.</p>
<ol class="steps">
<li><span>Copy a prompt into your image generator. Start with the rose's character sheet: every later rose prompt asks for it as the reference picture. A <em>sprite sheet</em> is one prompt that draws several pictures at once on a grid whose every cell is given in pixels; upload it whole and Claude cuts it apart. If a sheet will not keep to its grid, open <em>One at a time</em> on its card and make each picture with its own prompt.</span></li>
<li><span>Copy a prompt into your image generator. Start with the character sheets, the rose's first: every later picture of her, or of the fox, asks for its sheet as the reference picture. Each card says which roadmap phase first needs it. A <em>sprite sheet</em> is one prompt that draws several pictures at once on a grid whose every cell is given in pixels; upload it whole and Claude cuts it apart. If a sheet will not keep to its grid, open <em>One at a time</em> on its card and make each picture with its own prompt.</span></li>
<li><span>Upload or paste what it made: <em>Paste picture</em> on its card, or point at the card and press Ctrl+V (⌘V on a Mac). Compare it with the stand-in. The review points from <code>art/STYLE.md</code> are under each card if you want them; you don't have to tick them.</span></li>
<li><span>Accept it right away, or ask for another try with a note. Claude moves accepted pictures into the app.</span></li>
</ol>
@@ -444,8 +444,8 @@
const bg = a.background === 'transparent' ? 'transparent background' : 'full background';
const meta = sheet
? `sprite sheet · ${a.grid.cols} × ${a.grid.rows} grid · ${a.width} × ${a.height} px · ${bg} · makes ${a.cells.filter(Boolean).length} pictures`
: `${a.type} · ${a.width} × ${a.height} px · ${bg}${a.shipped || a.usedBy.some((u) => u.startsWith('Not in the app yet')) ? '' : ' · reference only, not in the app'}`;
? `Phase ${a.phase} · sprite sheet · ${a.grid.cols} × ${a.grid.rows} grid · ${a.width} × ${a.height} px · ${bg} · makes ${a.cells.filter(Boolean).length} pictures`
: `Phase ${a.phase} · ${a.type} · ${a.width} × ${a.height} px · ${bg}${a.shipped || a.usedBy.some((u) => u.startsWith('Not in the app yet')) ? '' : ' · reference only, not in the app'}`;
const el = h('article', { class: 'asset' + (sheet || a.type === 'map' ? ' wide' : ''), id: a.id, 'data-status': 'todo' },
h('div', { class: 'head' }, h('h3', { class: 'id', text: a.id }), refs.pill),
h('p', { class: 'meta', text: meta }),
+2 -1
View File
@@ -19,6 +19,7 @@ export interface BoardCell {
export interface BoardAsset {
readonly id: string;
readonly type: Asset['type'];
readonly phase: number;
readonly width: number;
readonly height: number;
readonly background: Background;
@@ -47,7 +48,7 @@ export function boardData(m: Manifest, styleMarkdown: string): BoardData {
const assets = m.assets.map((a): BoardAsset => {
const base = {
id: a.id, type: a.type, width: a.width, height: a.height, background: a.background,
id: a.id, type: a.type, phase: a.phase, width: a.width, height: a.height, background: a.background,
shipped: a.shipped, usedBy: a.usedBy, checks: a.checks, smallest: a.smallest,
attach: attachments(a, m), prompt: promptFor(a, m, style)
};
+6
View File
@@ -16,6 +16,8 @@ export interface Cell {
export interface Asset {
readonly id: string;
readonly type: AssetType;
/** The roadmap phase that first shows it (docs/ROADMAP.md §4). The manifest lists phases in order. */
readonly phase: number;
readonly width: number;
readonly height: number;
readonly background: Background;
@@ -88,8 +90,12 @@ export function checkManifest(m: Manifest, checklistLength: number): string[] {
else if (sheet.type !== 'sheet') problems.push(`character ${name}: "${c.sheet}" is a ${sheet.type}, not a character sheet`);
}
let lastPhase = 0;
for (const a of m.assets) {
claim(a.id, a.id);
if (!Number.isInteger(a.phase) || a.phase < 1 || a.phase > 6) problems.push(`${a.id}: phase ${String(a.phase)} is not a roadmap phase (1–6)`);
else if (a.phase < lastPhase) problems.push(`${a.id}: phase ${a.phase} comes after phase ${lastPhase}; list the pictures in phase order`);
else lastPhase = a.phase;
if (!TYPES.includes(a.type)) problems.push(`${a.id}: unknown type "${a.type}"`);
if (!GENERATOR_SIZES.some(([w, h]) => w === a.width && h === a.height)) {
problems.push(`${a.id}: ${a.width} × ${a.height} is not a size image generators offer (${GENERATOR_SIZES.map(([w, h]) => `${w} × ${h}`).join(', ')})`);
+150 -3
View File
@@ -20,7 +20,15 @@ const C = {
amber: '#f2b860',
coral: '#e9846a',
night: '#2e3561',
lamp: '#f4d58d'
lamp: '#f4d58d',
fox: '#b65a35',
cream: '#f3e3c8',
foxLeg: '#5a3a33',
strawberry: '#d2554e',
blueberry: '#5b6fa6',
raspberry: '#c2456a',
blackberry: '#3f2e4a',
hip: '#d0632e'
} as const;
type Eyes = 'open' | 'half' | 'closed' | 'down' | 'squeeze';
@@ -87,6 +95,82 @@ function rose(look: RoseLook): string {
return stem + thorns + leaves + bloom;
}
interface FoxLook {
readonly pose: 'sit' | 'stand' | 'lie' | 'curl';
readonly eyes: 'open' | 'half' | 'closed';
/** Faces right instead of left. */
readonly right?: boolean;
/** The head turned back over the shoulder. */
readonly back?: boolean;
/** Seen from behind: no face. */
readonly behind?: boolean;
readonly petal?: boolean;
readonly fluffed?: boolean;
/** Degrees the head tilts. */
readonly tilt?: number;
}
/** The fox in a 300 × 240 box, facing left unless `right`, feet on the bottom edge. */
function fox(look: FoxLook): string {
const ink = `stroke="${C.ink}" stroke-width="4"`;
const leg = (x: number, y0: number, y1: number): string => `<path d="M${x} ${y0} V ${y1}" stroke="${C.foxLeg}" stroke-width="14" stroke-linecap="round"/>`;
const thick = look.fluffed ? 8 : 0;
const tail = (d: string): string =>
`<path d="${d}" fill="none" stroke="${C.ink}" stroke-width="${38 + thick}" stroke-linecap="round"/>` +
`<path d="${d}" fill="none" stroke="${C.fox}" stroke-width="${30 + thick}" stroke-linecap="round"/>` +
`<path d="${d}" fill="none" stroke="${C.foxLeg}" stroke-width="${32 + thick}" stroke-dasharray="6 26" opacity=".45"/>`;
const head = (x: number, y: number, r: number): string => {
const k = look.back ? -1 : 1;
const ears = [-0.55, 0.35].map((o) => `<path d="M${x + o * r * k - 12} ${y - r * 0.6} l12 -${r * 0.9} l12 ${r * 0.9}z" fill="${C.fox}" ${ink}/>`).join('');
if (look.behind) return ears + `<circle cx="${x}" cy="${y}" r="${r}" fill="${C.fox}" ${ink}/>`;
const eye = (ex: number): string =>
look.eyes === 'open'
? `<circle cx="${ex}" cy="${y - 4}" r="4" fill="${C.ink}"/>`
: `<path d="M${ex - 6} ${y - 4} q6 ${look.eyes === 'half' ? 4 : 6} 12 0" fill="${look.eyes === 'half' ? C.ink : 'none'}" stroke="${C.ink}" stroke-width="3" stroke-linecap="round"/>`;
const snout = x - k * r * 0.75;
return ears + `<g transform="rotate(${look.tilt ?? 0} ${x} ${y})"><circle cx="${x}" cy="${y}" r="${r}" fill="${C.fox}" ${ink}/>
<ellipse cx="${snout + k * 6}" cy="${y + r * 0.35}" rx="${r * 0.55}" ry="${r * 0.38}" fill="${C.cream}" ${ink}/>
<circle cx="${x - k * 12}" cy="${y - r * 0.45}" r="5" fill="${C.cream}"/><circle cx="${x + k * 10}" cy="${y - r * 0.45}" r="5" fill="${C.cream}"/>
${eye(x - k * 13)}${eye(x + k * 9)}<circle cx="${snout - k * 6}" cy="${y + r * 0.3}" r="5" fill="${C.ink}"/>
${look.petal ? `<ellipse cx="${snout - k * 10}" cy="${y + r * 0.75}" rx="16" ry="9" fill="${C.cream}" ${ink}/>` : ''}</g>`;
};
let body: string;
switch (look.pose) {
case 'sit':
body = tail('M185 215 Q 250 205 240 150') + `<ellipse cx="160" cy="150" rx="50" ry="64" fill="${C.fox}" ${ink}/>`
+ `<ellipse cx="148" cy="160" rx="24" ry="38" fill="${C.cream}"/>` + leg(140, 175, 225) + leg(168, 175, 225)
+ head(look.back ? 175 : 145, 72, 38);
break;
case 'stand':
body = tail('M235 120 Q 280 110 290 60') + leg(110, 140, 225) + leg(130, 140, 225) + leg(200, 140, 225) + leg(220, 140, 225)
+ `<ellipse cx="165" cy="128" rx="80" ry="38" fill="${C.fox}" ${ink}/>` + head(look.back ? 215 : 80, 98, 34);
break;
case 'lie':
body = tail('M250 205 Q 285 215 290 180') + `<ellipse cx="170" cy="192" rx="92" ry="30" fill="${C.fox}" ${ink}/>`
+ leg(70, 215, 222) + head(72, 178, 32);
break;
case 'curl':
body = `<circle cx="150" cy="160" r="66" fill="${C.fox}" ${ink}/>` + tail('M205 200 Q 170 235 110 205') + head(125, 168, 30);
break;
}
return look.right ? `<g transform="translate(300 0) scale(-1 1)">${body}</g>` : body;
}
const FOXES: Record<string, FoxLook> = {
'fox-watching': { pose: 'sit', eyes: 'open', back: true },
'fox-curious': { pose: 'stand', eyes: 'open', tilt: -14 },
'fox-sitting': { pose: 'sit', eyes: 'half' },
'fox-resting': { pose: 'lie', eyes: 'half' },
'fox-petted': { pose: 'sit', eyes: 'closed', tilt: -18 },
'fox-brushed': { pose: 'sit', eyes: 'half', fluffed: true, tilt: 8 },
'fox-eating': { pose: 'stand', eyes: 'closed', tilt: -30 },
'fox-asleep': { pose: 'curl', eyes: 'closed' },
'fox-trotting': { pose: 'stand', eyes: 'open' },
'fox-leading': { pose: 'stand', eyes: 'open', right: true, back: true },
'fox-carrying-petal': { pose: 'stand', eyes: 'half', petal: true },
'fox-visiting': { pose: 'sit', eyes: 'half', tilt: 16 }
};
/** Place a drawing made in a w × h box centred in the target, filling about 76 %. */
function fit(body: string, w: number, h: number, W: number, H: number, fill = 0.76): string {
const s = Math.min((W * fill) / w, (H * fill) / h);
@@ -128,6 +212,51 @@ const PROPS: Record<string, string> = {
<path d="M62 134 v46 M138 134 v46 M80 134 v36 M120 134 v36" stroke="${C.wood}" stroke-width="9" stroke-linecap="round"/>`
};
const berries = (fill: string, at: readonly (readonly [number, number])[], r: number, leaves = 1): string =>
Array.from({ length: leaves }, (_, i) => `<ellipse cx="${80 + i * 40}" cy="58" rx="30" ry="13" fill="${C.leaf}" stroke="${C.ink}" stroke-width="4" transform="rotate(${i ? 25 : -25} ${80 + i * 40} 58)"/>`).join('')
+ `<path d="M100 40 V 80" stroke="${C.moss}" stroke-width="5"/>`
+ at.map(([x, y]) => `<circle cx="${x}" cy="${y}" r="${r}" fill="${fill}" stroke="${C.ink}" stroke-width="4"/>`).join('');
const bush = (extra: string): string =>
[[60, 120, 50], [140, 120, 50], [100, 80, 56], [100, 140, 46]].map(([x, y, r]) => `<circle cx="${x}" cy="${y}" r="${r}" fill="${C.leaf}" stroke="${C.ink}" stroke-width="4"/>`).join('')
+ `<path d="M70 70 q30 -14 60 0 M50 120 q20 -10 40 0 M115 125 q20 -10 40 0" fill="none" stroke="${C.moss}" stroke-width="4"/>` + extra;
/** The fox's food and the bush, each in a 200 × 200 box like PROPS. */
const MORE_PROPS: Record<string, string> = {
'wild-strawberries': berries(C.strawberry, [[70, 120], [110, 140], [140, 105]], 22, 2),
blueberries: berries(C.blueberry, [[70, 120], [100, 140], [130, 120], [85, 95], [118, 95]], 16, 2),
raspberries: berries(C.raspberry, [[72, 120], [110, 138], [138, 108]], 22),
blackberries: berries(C.blackberry, [[72, 120], [110, 138], [138, 108]], 22),
'rose-hips': `<circle cx="100" cy="115" r="80" fill="${C.lamp}" opacity=".3"/><path d="M100 30 V 70 M100 70 L 70 90 M100 70 L 130 90" stroke="${C.moss}" stroke-width="5" fill="none"/>`
+ [[70, 125], [130, 125]].map(([x, y]) => `<ellipse cx="${x}" cy="${y}" rx="24" ry="34" fill="${C.hip}" stroke="${C.ink}" stroke-width="4"/><path d="M${(x ?? 0) - 8} ${(y ?? 0) + 34} l8 10 l8 -10" fill="${C.foxLeg}"/>`).join(''),
'leaf-plate': `<path d="M20 110 Q 100 10 185 100 Q 100 190 20 110z" fill="${C.leaf}" stroke="${C.ink}" stroke-width="5"/><path d="M20 110 Q 100 100 185 100" fill="none" stroke="${C.moss}" stroke-width="5"/>`,
'bush-resting': bush(''),
'bush-flowering': bush([[55, 100], [100, 60], [145, 105], [90, 135], [125, 150]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="9" fill="${C.paper}" stroke="${C.ink}" stroke-width="3"/><circle cx="${x}" cy="${y}" r="3" fill="${C.amber}"/>`).join('')),
'bush-ripe': bush([[60, 105], [138, 108], [100, 70]].map(([x, y]) => `<ellipse cx="${x}" cy="${y}" rx="20" ry="15" fill="${C.lamp}" stroke="${C.moss}" stroke-width="3"/>`).join('')),
'fox-brush': `<path d="M30 110 Q 30 70 100 70 Q 170 70 170 110z" fill="${C.wood}" stroke="${C.ink}" stroke-width="5"/>`
+ Array.from({ length: 12 }, (_, i) => `<path d="M${40 + i * 11} 112 v26" stroke="${C.cream}" stroke-width="6" stroke-linecap="round"/>`).join('')
};
const meadow = (path: string): string =>
`<ellipse cx="100" cy="200" rx="92" ry="190" fill="${C.meadow}" stroke="${C.ink}" stroke-width="3" stroke-dasharray="10 8"/>${path}`;
const lantern = (lit: boolean): string =>
(lit ? `<circle cx="140" cy="170" r="60" fill="${C.lamp}" opacity=".45"/>` : '')
+ `<path d="M60 390 V 80 Q 60 40 100 40 Q 140 40 140 80 V 110" fill="none" stroke="${C.wood}" stroke-width="14" stroke-linecap="round"/>`
+ `<rect x="115" y="130" width="50" height="72" rx="8" fill="${lit ? C.lamp : '#e8eef0'}" stroke="${C.ink}" stroke-width="5"/>`
+ `<path d="M115 130 l25 -18 l25 18" fill="${C.foxLeg}" stroke="${C.ink}" stroke-width="4"/>`
+ `<rect x="133" y="160" width="14" height="30" fill="${C.paper}" stroke="${C.ink}" stroke-width="3"/>`
+ (lit ? `<path d="M140 160 q-8 -12 0 -22 q8 10 0 22z" fill="${C.amber}" stroke="${C.ink}" stroke-width="2"/>` : '');
/** Tall things, each in a 200 × 400 box: the path stretches and the lanterns. */
const TALL: Record<string, string> = {
'path-prints': meadow([340, 290, 240, 190, 140, 95, 55].map((y, i) => `<ellipse cx="${100 + (i % 2 ? 12 : -12) * (1 - i / 9)}" cy="${y}" rx="${9 - i}" ry="${7 - i * 0.7}" fill="${C.soil}"/>`).join('')),
'path-trail': meadow(`<path d="M92 385 Q 120 260 96 160 T 100 15" fill="none" stroke="#c8d8a8" stroke-width="22" stroke-linecap="round"/><path d="M92 385 Q 120 260 96 160 T 100 15" fill="none" stroke="${C.soil}" stroke-width="5" stroke-dasharray="4 18"/>`),
'path-road': meadow(`<path d="M60 388 Q 110 260 88 160 T 92 15 L 108 15 Q 120 120 112 170 T 140 388z" fill="${C.soil}" stroke="${C.ink}" stroke-width="4"/>`
+ [[52, 360], [148, 360], [70, 260], [130, 255], [80, 160], [118, 150], [88, 70], [110, 65]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="7" fill="#c9bcae" stroke="${C.ink}" stroke-width="2"/>`).join('')),
'lantern-unlit': lantern(false),
'lantern-lit': lantern(true)
};
function garden(W: number, H: number, time: 'morning' | 'day' | 'sunset' | 'night'): string {
const tint = {
morning: { field: '#b8d1a0', far: '#c9dbe0', wall: '#b4a596', light: '#ffffff' },
@@ -149,6 +278,14 @@ function single(a: Asset): string {
const { width: W, height: H } = a;
switch (a.type) {
case 'sheet': {
if (a.character === 'fox') {
const views: FoxLook[] = [{ pose: 'sit', eyes: 'half' }, { pose: 'stand', eyes: 'half' }, { pose: 'stand', eyes: 'half', tilt: -8 }, { pose: 'sit', eyes: 'half', behind: true }];
const figures = views.map((l, i) => `<g transform="translate(${30 + i * 375} 60) scale(1.15)">${fox(l)}</g>`).join('');
const heads: FoxLook[] = [{ pose: 'sit', eyes: 'half' }, { pose: 'sit', eyes: 'open', tilt: -14 }, { pose: 'sit', eyes: 'closed' }];
// Close-ups: only the head, cropped by a nested viewBox.
const close = heads.map((l, i) => `<svg x="${200 + i * 400}" y="620" width="320" height="320" viewBox="90 10 120 120">${fox(l)}</svg>`).join('');
return `<rect width="${W}" height="${H}" fill="${C.paper}"/>${figures}${close}`;
}
const looks: RoseLook[] = [
{ stage: 'full', eyes: 'half', mouth: 'smile' },
{ stage: 'full', eyes: 'half', mouth: 'smile', tilt: -12 },
@@ -166,7 +303,7 @@ function single(a: Asset): string {
return `<rect width="${W}" height="${H}" fill="${C.paper}"/>${figures}${close}`;
}
case 'sprite':
return fit(PROPS[a.id] ?? '', 200, 200, W, H, 0.7);
return fit(drawing(PROPS, a.id), 200, 200, W, H, 0.7);
case 'layer': {
const time = (['morning', 'day', 'sunset', 'night'] as const).find((t) => a.id.endsWith(t)) ?? 'day';
return garden(W, H, time);
@@ -179,11 +316,21 @@ function single(a: Asset): string {
}
}
/** A stand-in drawing by id. A picture with none fails the build rather than showing an empty box. */
function drawing(from: Record<string, string>, id: string): string {
const d = from[id];
if (d === undefined) throw new Error(`tools/art-prep/src/placeholders.ts has no stand-in drawing for "${id}"`);
return d;
}
/** One cell's drawing, sized to the cell it ships at. */
function cellBody(id: string, W: number, H: number): string {
const look = ROSES[id];
if (look) return fit(rose(look), 200, 520, W, H);
return fit(PROPS[id] ?? '', 200, 200, W, H, 0.7);
const pose = FOXES[id];
if (pose) return fit(fox(pose), 300, 240, W, H);
if (id in TALL) return fit(drawing(TALL, id), 200, 400, W, H);
return fit(drawing({ ...PROPS, ...MORE_PROPS }, id), 200, 200, W, H, 0.7);
}
function sheet(a: Asset): string {
+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';