import { test } from "node:test"; import assert from "node:assert/strict"; import { ENLARGE_WARN, STACKED_PICTURE_K, cropToBox, panelCells, stackedCaptionGeo, stackedGeometry, stackedOn, stackedSafe, stackedStandDowns, twoCropEnlargement, twoCropGraph, } from "./vertical-deck.mjs"; import { verticalRender } from "./vertical.mjs"; import { deckGeometry, deckLayout, deckSchedule, instrumentsGeometry, pictureK, resolveDeck, stampGeometry, statsGeometry, validateChrome, } from "./deck.mjs"; import { verticalKnobs, validateVerticalRender } from "yt-dlp-transcript-common/lib/report/vertical.mjs"; import { validateLook } from "yt-dlp-transcript-common/lib/report/look.mjs"; import { measureExtraGeometry } from "./measure-extras.mjs"; import { stackedLeftOut, MODULES, verticalFormOf } from "./modules/index.mjs"; import { stackedLintWarnings } from "./lint.mjs"; import { stackedDeckHtml, stackedSections, wordmarkOf } from "./chrome-vdeck.mjs"; import { dialFinaleGeometry } from "./chrome-instruments.mjs"; const DECK = { engine: "hyperframes", layout: "deck", deck: {} }; const landscape = (deck = {}) => ({ width: 1920, height: 1080, fps: 30, chrome: { ...DECK, deck }, palette: { bg: "#0F1312", fg: "#EDF0EC", accent: "#22AB83" } }); const stacked = (deck = {}, vertical = {}) => verticalRender({ ...landscape(deck), format: "vertical", vertical }); const inside = (r, a) => r.x >= a.x0 - 1e-9 && r.x + r.width <= a.x1 + 1e-9 && r.y >= a.y0 - 1e-9 && r.y + r.height <= a.y1 + 1e-9; test("the knob: absent is stacked; bare and stacked validate; anything else is refused", () => { assert.equal(verticalKnobs({}).deck, "stacked"); assert.equal(verticalKnobs({ vertical: { deck: "bare" } }).deck, "bare"); assert.deepEqual(validateVerticalRender({ render: { format: "vertical", vertical: { deck: "stacked" } } }), []); assert.ok(validateVerticalRender({ render: { vertical: { deck: "tall" } } })[0].includes("render.vertical.deck")); }); test("stacked only where a vertical cut keeps a deck; bare and landscape never", () => { assert.equal(stackedOn(stacked()), true); assert.equal(stackedOn(stacked({}, { deck: "bare" })), false); assert.equal(stackedOn(landscape()), false); // A vertical cut with no deck is the bare vertical whatever it says. assert.equal(stackedOn(verticalRender({ width: 1920, height: 1080, format: "vertical" })), false); // verticalRender keeps the chrome only for the stacked deck. assert.ok(stacked().chrome); assert.equal(stacked({}, { deck: "bare" }).chrome, undefined); }); test("bare is the vertical as it shipped, byte for byte: the same render, whatever the deck", () => { const withDeck = verticalRender({ ...landscape(), format: "vertical", vertical: { deck: "bare" } }); const noDeck = verticalRender({ ...landscape(), chrome: undefined, format: "vertical", vertical: { deck: "bare" } }); assert.equal(JSON.stringify(withDeck), JSON.stringify(noDeck)); // And a deck-less vertical cut is unchanged by the default. const plain = verticalRender({ width: 1920, height: 1080, fps: 30, format: "vertical" }); assert.equal(plain.chrome, undefined); assert.equal(plain.width, 1080); }); test("every zone of the stacked deck keeps inside the safe area; the picture is the frame's width", () => { for (const safe of [{}, { top: 0.1, bottom: 0.22, right: 0.14 }]) { const r = stacked({ measure: {} }, { safe }); const g = stackedGeometry(r, { counter: true }); const a = stackedSafe(r); for (const [name, box] of [["rail", g.rail], ["captions", g.captions], ["panel", g.panel], ["counters", g.counters], ["source", g.source], ["card", g.post.card], ["post counters", g.post.counters], ["finale", g.finale.column]]) { assert.ok(inside(box, a), `${name} ${JSON.stringify(box)} inside ${JSON.stringify(a)}`); } // What stands over the picture -- the stamps and the stats at every corner, the measure extras at every anchor -- // keeps inside the safe area too (the picture itself is the frame's whole width). for (const position of ["top-left", "top-right", "bottom-left", "bottom-right"]) { const rr = stacked({ measure: {} }, { safe }); const fc = { ...rr, chrome: { ...rr.chrome, factcheck: { stamp: { position } }, stats: { position } } }; assert.ok(inside(stampGeometry(fc), a), `stamp ${position} ${JSON.stringify(stampGeometry(fc))}`); assert.ok(inside(statsGeometry(fc), a), `stats ${position} ${JSON.stringify(statsGeometry(fc))}`); } for (const id of ["goals", "peak", "diet", "streak"]) { for (const position of ["top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center"]) { const rr = { ...r, chrome: { ...r.chrome, deck: { ...r.chrome.deck, [id]: { position } } } }; const box = measureExtraGeometry(id, rr); assert.ok(inside(box, a), `${id} ${position} ${JSON.stringify(box)}`); } } // Nothing that must be read in the right band or the bottom band. for (const box of [g.rail, g.captions, g.panel, g.source, g.counters]) { assert.ok(box.x + box.width <= a.x1); assert.ok(box.y + box.height <= a.y1); } // The picture: the frame's full width, 16:9, under the rail and over the captions. assert.equal(g.picture.width, g.W); assert.equal(g.picture.height, Math.round((g.W * 9) / 16 / 2) * 2); assert.ok(g.picture.y >= g.rail.y + g.rail.height); assert.ok(g.captions.y >= g.picture.y + g.picture.height); // The zones stack top to bottom without meeting. assert.ok(g.panel.y >= g.captions.y + g.captions.height); assert.ok(g.counters.y >= g.panel.y + g.panel.height); assert.ok(g.source.y >= g.counters.y + g.counters.height); // Only the wordmark and the twocrop's small QR stand in the bottom band. assert.ok(g.wordmark.y >= a.y1); assert.ok(g.twocrop.qr.y >= a.y1 && g.twocrop.qr.x + g.twocrop.qr.size <= a.x1); } }); test("the twocrop bands: crop one, the strip, crop two to the bottom band; its captions over crop two's foot", () => { const r = stacked(); const g = stackedGeometry(r); const t = g.twocrop; assert.equal(t.crop1.y + t.crop1.height, t.strip.y); assert.equal(t.strip.y + t.strip.height, t.crop2.y); assert.ok(t.crop2.y + t.crop2.height <= g.safe.y1); assert.ok(t.top.y >= g.safe.y0 && t.top.y + t.top.height <= t.crop1.y); const cap = stackedCaptionGeo(r, { twocrop: true }); assert.equal(cap.captions.align, 2); assert.ok(g.H - cap.captions.marginV <= t.crop2.y + t.crop2.height && g.H - cap.captions.marginV > t.crop2.y); // Under the picture otherwise, top-aligned, inside the safe edges. const c = stackedCaptionGeo(r); assert.equal(c.captions.align, 8); assert.equal(c.captions.marginV, g.captions.y); assert.ok(c.captions.marginR >= g.W - g.safe.x1); }); test("a crop is cut to its band's aspect about its centre; the enlargement is said past 2.5x", () => { const box = { width: 1080, height: 629 }; const c = cropToBox([0, 0, 0.5, 0.5], 1920, 1080, box); assert.ok(Math.abs(c.w / c.h - box.width / box.height) < 0.01); assert.ok(c.x >= 0 && c.x + c.w <= 1920 && c.y >= 0 && c.y + c.h <= 1080); const r = stacked(); const [a, b] = twoCropEnlargement([[0, 0, 0.9, 0.9], [0.8, 0.8, 0.2, 0.2]], 1920, 1080, r); assert.ok(a < ENLARGE_WARN); assert.ok(b > ENLARGE_WARN); const graph = twoCropGraph({ crops: [[0, 0, 0.6, 0.6], [0.6, 0.6, 0.4, 0.4]], srcW: 1920, srcH: 1080, render: r, fps: 30 }); assert.ok(graph.includes(`pad=1080:1920:0:${stackedGeometry(r).twocrop.crop1.y}`)); assert.ok(!graph.includes("color=c="), "no endless colour source under an overlay"); assert.ok(graph.includes(`overlay=x=0:y=${stackedGeometry(r).twocrop.crop2.y}`)); assert.ok(graph.startsWith("setsar=1,split=2")); }); test("a clip's twocrop: its crops required, two boxes inside the picture; the lint says a soft band", () => { const ok = { render: {}, timeline: [{ type: "clip", id: "a", vertical: { layout: "twocrop", crops: [[0, 0, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5]] } }] }; assert.deepEqual(validateLook(ok), []); assert.ok(validateLook({ render: {}, timeline: [{ type: "clip", id: "a", vertical: { layout: "twocrop" } }] })[0].includes("needs")); assert.ok(validateLook({ render: {}, timeline: [{ type: "clip", id: "a", vertical: { layout: "twocrop", crops: [[0, 0, 1.5, 0.5], [0, 0, 0.5, 0.5]] } }] }).some((x) => x.includes("inside"))); assert.ok(validateLook({ render: {}, timeline: [{ type: "clip", id: "a", vertical: { layout: "full", crops: [[0, 0, 0.5, 0.5], [0, 0, 0.5, 0.5]] } }] }).some((x) => x.includes("twocrop"))); const m = { render: { ...landscape(), format: "vertical" }, timeline: [{ type: "clip", id: "a", vertical: { layout: "twocrop", crops: [[0, 0, 0.9, 0.9], [0.9, 0.9, 0.1, 0.1]] } }] }; assert.equal(stackedLintWarnings(m).length, 1); assert.ok(stackedLintWarnings(m)[0].includes("crops[1]")); assert.ok(stackedLintWarnings({ ...m, render: { ...m.render, vertical: { deck: "bare" } } })[0].includes("stacked deck's")); }); test("the panel: the dial tall at the left, the odometer and the trail down the right; what does not fit is left out", () => { const p = { x: 0, y: 0, width: 900, height: 300 }; const { cells, out } = panelCells(p, [{ id: "dial", tall: true, aspect: 1 }, { id: "odometer", aspect: 600 / 140 }, { id: "trail", aspect: 600 / 138 }], 20); assert.deepEqual(out, []); assert.equal(cells.dial.x, 0); assert.equal(cells.dial.height, 300); assert.ok(cells.odometer.x > cells.dial.x + cells.dial.width); assert.ok(cells.trail.y >= cells.odometer.y + cells.odometer.height); // Too many for the room: the last is left out, never squashed. const crowd = panelCells(p, [{ id: "a", aspect: 2 }, { id: "b", aspect: 2 }, { id: "c", aspect: 2 }, { id: "d", aspect: 2 }, { id: "e", aspect: 2 }], 20); assert.ok(crowd.out.length >= 1); for (const c of Object.values(crowd.cells)) assert.ok(c.y + c.height <= p.height); }); test("the stacked geometry answers deck.mjs's: the footage the picture, the instruments in the panel, the shell the frame", () => { const r = stacked({ measure: {} }); const d = deckGeometry(r); const g = stackedGeometry(r); assert.deepEqual(d.footage, g.picture); assert.deepEqual(d.deck, { x: 0, y: 0, width: 1080, height: 1920 }); const ig = instrumentsGeometry(r); for (const n of ["dial", "odometer", "trail"]) assert.ok(inside(ig[n], stackedSafe(r)), n); assert.equal(pictureK(r), STACKED_PICTURE_K); // The posts stay popups that never move the picture. assert.equal(resolveDeck(r).posts.shift, false); assert.equal(resolveDeck(r).posts.layout, "popup"); assert.equal(resolveDeck(r).posts.show, false); // The landscape fit checks do not apply. assert.deepEqual(validateChrome(r.chrome, r), []); // As the chrome preview route asks it: the render without its chrome beside the chrome. const { chrome: _c, ...rest } = r; assert.deepEqual(validateChrome(r.chrome, rest), []); // The stamp over the picture's lower-left by default, inside it. const st = stampGeometry(r); assert.ok(st.x >= d.footage.x && st.y + st.height <= d.footage.y + d.footage.height); // A measure extra over the picture. const diet = measureExtraGeometry("diet", r); assert.ok(diet.y >= d.footage.y && diet.y + diet.height <= d.footage.y + d.footage.height); // The dial's finale: the column over the picture's room, inside the safe area. assert.ok(inside(dialFinaleGeometry({ finale: { from: 0, to: 5 } }, r), stackedSafe(r))); }); test("landscape at 1080 is the deck as it always was; 720p fits instead of standing at y < 0", () => { const r = landscape(); assert.deepEqual(deckGeometry(r), { W: 1920, H: 1080, footage: { x: 173, y: 2, width: 1574, height: 886 }, deck: { x: 0, y: 890, width: 1920, height: 190 } }); assert.deepEqual(resolveDeck(r).title, { size: 54, maxChars: 48 }); assert.equal(resolveDeck(r).height, 190); const lay = deckLayout(r); assert.equal(lay.text.titleSize, 54); assert.equal(lay.qr.size, 150); const r720 = { ...r, width: 1280, height: 720 }; const g = deckGeometry(r720); assert.ok(g.footage.y >= 0, `footage y ${g.footage.y}`); assert.ok(g.footage.y + g.footage.height <= g.deck.y); assert.equal(g.deck.y + g.deck.height, 720); assert.deepEqual(validateChrome(r720.chrome, r720), []); // Its band scaled with the height: two thirds of the 1080 deck. assert.equal(g.deck.height, Math.round(190 * (720 / 1080))); assert.equal(deckLayout(r720).text.titleSize, 36); }); test("the schedule: a stacked deck's clips carry their source parts and a twocrop its layout; landscape does not", () => { const entries = [ { id: "c1", type: "clip", video: "v1", start: 125, end: 130, title: "First", channelTitle: "Chan", date: "2026-01-12" }, { id: "c2", type: "clip", video: "v2", start: 5, end: 9, title: "Second", vertical: { layout: "twocrop", crops: [[0, 0, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5]] } }, { id: "p1", type: "post", platform: "x", author: "A", handle: "a", date: "2026-11-04", text: "hi" }, ]; const args = { entries, durs: [5, 4, 6], D: 0.4, provenance: {}, metas: [null, null, null] }; const v = deckSchedule({ ...args, render: stacked() }); assert.equal(v.segments[0].vsource.clock, "2:05"); assert.equal(v.segments[0].vsource.channel, "Chan"); assert.equal(v.segments[1].vlayout, "twocrop"); assert.equal(v.segments[2].vsource, undefined); assert.deepEqual(stackedStandDowns(v).map((x) => x.why), ["twocrop", "post"]); const l = deckSchedule({ ...args, render: landscape() }); assert.equal(l.segments[0].vsource, undefined); assert.equal(l.segments[1].vlayout, undefined); }); test("the shell's page in 9:16: the rail's sections, each segment's source block and its QR, the wordmark", () => { const r = stacked({ markers: [{ after: "c1", label: "Carnivore", color: "#C9534B" }], sectionTitle: { first: "The first diets" }, pip: { color: "section" } }); const entries = [ { id: "c1", type: "clip", video: "v1", start: 5, end: 9, title: "First", channelTitle: "Chan", date: "2026-01-12" }, { id: "c2", type: "clip", video: "v2", start: 5, end: 9, title: "Second", channelTitle: "Chan", date: "2026-01-13" }, ]; const sched = deckSchedule({ entries, durs: [4, 4], D: 0.4, render: r, provenance: {}, metas: [null, null] }); const sec = stackedSections(sched, r); assert.deepEqual(sec.sections.map((s) => s.label), ["The first diets", "Carnivore"]); const html = stackedDeckHtml(sched, r, { qrSrcs: { c1: "assets/qr00.png" }, site: wordmarkOf({ siteOrigin: "https://jeralyzer.pages.dev" }) }); assert.ok(html.includes('data-width="1080" data-height="1920"')); assert.ok(html.includes("JERALYZER")); assert.ok(html.includes("Carnivore") && html.includes("The first diets")); assert.ok(html.includes("assets/qr00.png")); assert.ok(html.includes('id="deck-data"')); assert.ok(html.includes("1 / 2") && html.includes("2 / 2")); }); test("what the stacked deck leaves out is said; every module that stands in it declares where", () => { const forms = new Map(MODULES.map((m) => [m.id, verticalFormOf(m)?.slot ?? null])); assert.equal(forms.get("shell"), "frame"); assert.equal(forms.get("dial"), "panel"); assert.equal(forms.get("dial-finale"), "finale"); assert.equal(forms.get("popup-posts"), null); const m = { render: { ...landscape({ measure: {} }), format: "vertical", chrome: { ...DECK, deck: { measure: {} }, flips: { items: [] } } }, posts: [{ id: "p" }], timeline: [] }; const words = stackedLeftOut(m); assert.ok(words.some((w) => w.startsWith("popup-posts:"))); assert.ok(words.some((w) => w.startsWith("flips:"))); assert.deepEqual(stackedLeftOut({ ...m, render: { ...m.render, vertical: { deck: "bare" } } }), []); // The finale's diet runs, with a finale to draw them in. const runs = { ...m, render: { ...m.render, chrome: { ...m.render.chrome, deck: { finale: { dietRuns: true } } } }, timeline: [{ type: "clip", id: "n", layout: "finale" }] }; assert.ok(stackedLeftOut(runs).some((w) => w.startsWith("runs-finale:"))); assert.ok(!stackedLeftOut(m).some((w) => w.startsWith("chart:")), "the chart band only under its own legacy engine"); assert.deepEqual(stackedLeftOut({ ...m, render: landscape() }), []); }); // ---- landscape and the bare vertical: byte for byte what main drew ----------------------------- // // md5s taken from main (7f7767a0) with the same fixture -- the measure-dial cut of instruments.test.mjs with // markers and a section title: the estimate's schedule, the deck's page, the dial's, the odometer's, the trail's, // the dial finale's and the deck's geometry; and the bare vertical's render, each clip layout's geometry, picture // graph and words, and a post's box. const MAIN = { schedule: "4ebd0afd1cddb975b6d20ce934df2158", deck: "546848c82d65e45e4d1a4ac4c7a9c3c8", dial: "f7e21e4a3622703975f746d39cbcb738", odometer: "8425983d217408dddcb6ee794881c6c4", // Re-pinned on lane/frame-zero (11 Nov): the trail's axes fit the weights said so far and reflow, its remembered // weights are points, its time axis breaks over long empty stretches (trail-plan.mjs) -- the page is new by design. // Main's was 3512192be69f8b9bc33aec6e7b41a088. Re-pinned on lane/trail-join (12 Nov): one line through every weight // shown by date (the remembered too, quieter), one point per day, the breaks and years at the axis foot -- new by // design; frame-zero's was 39c3694f4e26963277d9b22ebfd0f60b. // The trail's page moved on purpose (12 Nov, lane/take-tools: its width by days AND by the weights a stretch holds). trail: "cb462817cd12d54f5691f1dcf68daeb8", dialFinale: "52866e4d87e15bd55afe8c1a703414a3", geometry: "182959796c281f769766df3d02962904", bare: "7ce1f7a66452adec21575bcdbba900f1", }; test("a landscape cut and a bare vertical draw what main drew, byte for byte", async () => { const { createHash } = await import("node:crypto"); const { readFileSync } = await import("node:fs"); const path = await import("node:path"); const { fileURLToPath } = await import("node:url"); const deck = await import("./deck.mjs"); const ci = await import("./chrome-instruments.mjs"); const cd = await import("./chrome-deck.mjs"); const v = await import("./vertical.mjs"); const here = path.dirname(fileURLToPath(import.meta.url)); const md5 = (s) => createHash("md5").update(typeof s === "string" ? s : JSON.stringify(s)).digest("hex"); const MEASURE = JSON.parse(readFileSync(path.join(here, "fixtures/measure-dial/measure.json"), "utf8")); const RENDER = { width: 1920, height: 1080, fps: 30, transition: 0.4, palette: { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }, chrome: { ...DECK, deck: { dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false }, markers: [{ after: "c3", label: "Two" }], sectionTitle: { first: "One" } } }, }; const timeline = Array.from({ length: 9 }, (_, i) => ({ type: "clip", id: `c${i + 1}`, video: "vidx", start: 10 * i, end: 10 * i + (i === 8 ? 14 : 8), cite: 1, section: 0, quote: "q", onscreen: { title: `Clip ${i + 1}` }, ...(i === 8 ? { layout: "finale" } : {}), })); const s = { ...deck.estimateSchedule({ slug: "m", title: "M", provenance: {}, render: RENDER, timeline }), measure: MEASURE }; const fonts = { DeckSans: "assets/r.ttf", DeckSansBold: "assets/b.ttf" }; assert.equal(md5(s), MAIN.schedule); assert.equal(md5(cd.deckHtml(s, RENDER, { fonts: { regular: "r.ttf", bold: "b.ttf" } })), MAIN.deck); assert.equal(md5(ci.dialHtml(s, RENDER, { fonts })), MAIN.dial); assert.equal(md5(ci.odometerHtml(s, RENDER, { fonts })), MAIN.odometer); assert.equal(md5(ci.trailHtml(s, RENDER, { fonts })), MAIN.trail); const win = deck.snapWindow({ segment: "dial-finale", from: s.finale.from, to: s.finale.to }, { fps: 30, total: s.total }); assert.equal(md5(ci.dialFinaleHtml(s, RENDER, win, { fonts })), MAIN.dialFinale); assert.equal(md5([deck.deckGeometry(RENDER), deck.instrumentsGeometry(RENDER), deck.deckLayout(RENDER, { schedule: s }), deck.stampGeometry(RENDER), deck.statsGeometry({ ...RENDER, chrome: { ...RENDER.chrome, stats: {} } })]), MAIN.geometry); const vr = v.verticalRender({ ...RENDER, format: "vertical", vertical: { deck: "bare", clip: "framed", hook: "section" } }); const words = [{ text: "so", start: 0.2, end: 0.4 }, { text: "the", start: 0.45, end: 0.6 }, { text: "scale", start: 0.62, end: 1 }, { text: "says", start: 1.1, end: 1.4 }]; const bare = { render: vr, layouts: {} }; for (const layout of ["full", "framed", "quote", "split", "overlay"]) { const geo = v.clipGeometry(layout, vr); bare.layouts[layout] = { geo, graph: v.verticalClipGraph({ geo, srcW: 1920, srcH: 1080, crop: null, fps: 30 }), ass: v.verticalAss({ geo, render: vr, words, seconds: 3, tag: "Chan · 12 Jan 2026", hook: "One" }) }; } bare.post = v.verticalPostBox(vr); assert.equal(md5(bare), MAIN.bare); }); test("the lint reads a vertical cut's QR at 720p on its short side, at the size the stacked deck draws it", async () => { const { lintManifest, qrsOf } = await import("./lint.mjs"); const render = stacked(); const timeline = [ { type: "clip", id: "a", video: "v7eqa6e", channel: "the-quartering-rumble", start: 633.42, end: 644.16, citeUrl: "https://jeralyzer.pages.dev/channel/the-quartering-rumble/v7eqa6e?t=633" }, { type: "clip", id: "b", video: "v7eqa6e", start: 1, end: 5, citeUrl: "https://jeralyzer.pages.dev/channel/the-quartering-rumble/v7eqa6e?t=1", vertical: { layout: "twocrop", crops: [[0, 0, 0.6, 0.6], [0.6, 0.4, 0.4, 0.6]] } }, ]; const m = { slug: "s", render, provenance: { siteOrigin: "https://jeralyzer.pages.dev" }, timeline }; const qrs = qrsOf(m); assert.deepEqual(qrs.map((q) => q.px), [140, 108]); const l = lintManifest(m, { validators: false }); assert.ok(!l.errors.some((e) => e.includes("too small to scan")), l.errors.join("; ")); }); test("a stacked vertical deck's render declares at least its measured peak + margin; a bare one what it did", async () => { const { VERTICAL_DECK_MIN_MB, manifestEstimateMb } = await import("./render-estimate.mjs"); const one = (render) => manifestEstimateMb({ render, timeline: [{ type: "clip", id: "a" }] }, {}, { single: true }); const v = { format: "vertical", chrome: { engine: "hyperframes", layout: "deck", deck: {} } }; assert.ok(one(v) >= VERTICAL_DECK_MIN_MB); assert.equal(one({ ...v, vertical: { deck: "bare" } }), one({ chrome: v.chrome })); }); test("with the tally's row the dial, the odometer and the trail still stand in the panel (a cell a size down, never squashed)", () => { const r = verticalRender({ ...landscape({ dial: true, odometer: true, trail: true }), format: "vertical", chrome: { ...DECK, deck: { dial: true, odometer: true, trail: true }, factcheck: {} } }); const ig = instrumentsGeometry(r); assert.deepEqual(ig.out, []); for (const n of ["dial", "odometer", "trail"]) assert.ok(ig[n], n); assert.ok(Math.abs(ig.trail.width / ig.trail.height - 600 / 138) < 0.1); assert.ok(ig.trail.y + ig.trail.height <= ig.column.y + ig.column.height); }); test("720p: markers (two rows), a two-line subtitle, a goalpost and a tally all fit inside the scaled band", () => { const deck = { footageScale: 0.7, subtitle: { lines: 2 }, sectionTitle: { first: "Opening" }, markers: [{ after: "c1", label: "A long first section" }, { after: "c2", label: "Another long section" }, { after: "c3", label: "And a third one" }], claims: [{ kind: "goalpost", label: "Pill test results", steps: [{ at: "c2", t: 1, said: "“3–5 weeks”", from: "2026-09-23", due: ["P3W", "P5W"] }] }], }; const r = { width: 1280, height: 720, fps: 30, chrome: { ...DECK, deck }, palette: { bg: "#0F1312", fg: "#EDF0EC" } }; assert.deepEqual(validateChrome(r.chrome, r), []); const g = deckGeometry(r); assert.ok(g.footage.y >= 0 && g.footage.y + g.footage.height <= g.deck.y); const lay = deckLayout(r, { tally: ["CORROBORATED", "CONTRADICTED", "UNVERIFIED"] }); assert.equal(lay.scale, 2 / 3); const t = lay.text; const textBottom = t.subtitleY + (t.headBox ?? 0) + t.subtitleBox; assert.ok(textBottom <= lay.height, `text bottom ${textBottom} in a ${lay.height} px band`); assert.ok(lay.tally.y >= 0 && lay.tally.y + lay.tally.height <= lay.height, JSON.stringify(lay.tally)); assert.ok(lay.tally.cell >= 80, "the tally's cells scaled, not squashed"); assert.ok(lay.qr.y + lay.qr.size <= lay.height); // A size written in pixels stays those pixels at 720. assert.equal(resolveDeck({ ...r, chrome: { ...DECK, deck: { ...deck, height: 200, qr: { size: 120 } } } }).height, 200); assert.equal(resolveDeck({ ...r, chrome: { ...DECK, deck: { ...deck, qr: { size: 120 } } } }).qr.size, 120); }); test("a --vertical build of a landscape deck cut (umtool vertical) declares the stacked floor too; --deck bare does not", async () => { const { mkdtemp, writeFile, rm } = await import("node:fs/promises"); const { tmpdir } = await import("node:os"); const path = await import("node:path"); const { VERTICAL_DECK_MIN_MB, manifestEstimateMb } = await import("./render-estimate.mjs"); const { cliEstimateMb } = await import("./build-video.mjs"); const m = { render: { width: 1920, height: 1080, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }, timeline: [{ type: "clip", id: "a" }] }; assert.ok(manifestEstimateMb(m, {}, { single: true, vertical: true }) >= VERTICAL_DECK_MIN_MB); assert.equal(manifestEstimateMb(m, {}, { single: true, vertical: { deck: "bare" } }), manifestEstimateMb(m, {}, { single: true })); const dir = await mkdtemp(path.join(tmpdir(), "vdeck-est-")); try { const file = path.join(dir, "m.json"); await writeFile(file, JSON.stringify(m)); assert.ok((await cliEstimateMb(file, { vertical: true, verticalKnobs: {}, short: false, clipPreview: false }, {})) >= VERTICAL_DECK_MIN_MB); assert.ok((await cliEstimateMb(file, { vertical: true, verticalKnobs: { deck: "bare" } }, {})) < VERTICAL_DECK_MIN_MB || manifestEstimateMb(m, {}) >= VERTICAL_DECK_MIN_MB); } finally { await rm(dir, { recursive: true, force: true }); } }); test("a stacked short's pieces are cut from the built cut clear of its dissolves, never past their own segment", async () => { const { builtSpans } = await import("./reframe.mjs"); const schedule = { transition: 0.5, segments: [{ id: "a", start: 0, duration: 6 }, { id: "b", start: 5.5, duration: 8 }, { id: "c", start: 13, duration: 4 }] }; assert.deepEqual(builtSpans([{ id: "a", from: 0, to: null }, { id: "b", from: 1, to: 20 }, { id: "c", from: 0, to: null }], schedule), [ { from: 0, to: 5.5 }, { from: 6.5, to: 13 }, { from: 13.5, to: 17 }, ]); // A piece the build does not have: joined from the segments as before. assert.equal(builtSpans([{ id: "z", from: 0, to: null }], schedule), null); assert.equal(builtSpans([{ id: "a", from: 0, to: null }], null), null); }); test("a bare short's outro is the card it always was: no end card, the same key", async () => { const { endCardOf } = await import("../lib/report/verticalCli.mjs"); const { outroKey } = await import("./outro.mjs"); const render = { width: 1920, height: 1080, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }; const timeline = [{ type: "clip", id: "a", video: "v", start: 61, channelTitle: "Chan", date: "2026-01-12" }]; const provenance = { siteOrigin: "https://jeralyzer.pages.dev" }; assert.equal(await endCardOf({ render, knobs: { deck: "bare" }, provenance, timeline }), null); assert.equal(await endCardOf({ render: { width: 1920, height: 1080 }, knobs: {}, provenance, timeline }), null); assert.deepEqual(await endCardOf({ render, knobs: {}, provenance, timeline }), { qrUrl: "https://jeralyzer.pages.dev", sources: [{ date: "Jan 12", label: "Chan · 1:01" }] }); // The card's key without an end card is the one it always was (v1, no `end`): pinned. const brand = { name: "Jeralyzer", lead: "Jer", ink: "#5fc4a6" }; assert.equal(outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand }), outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand, end: null })); assert.equal(outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand }), "ccb58d2be90ba1171c1e"); // main 195bd7d8 });