// The rev 9 integration fixes on the measure's instruments and extras (6 Nov; the rev9-panel preview's // list A–K): instruments on by default with a measure, the dial's pre-state, a loss goal's base, ranges kept // as ranges, the finale's ghost, the finale rail's labels, the finale's crossfade and caption line, the promise // clock in the column's trail slot (and its strip over a post card in the footage box), and the wedge. import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import path from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; import { estimateSchedule, validateChrome } from "./deck.mjs"; import { dialFinaleHandoff, dialFinaleHtml, dialHtml, goalWords, trailHtml, trailYields } from "./chrome-instruments.mjs"; import { titleLast } from "./chrome-finale.mjs"; import { instrumentsOn, resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs"; import { measureTrack, wedgeRange, weightWords } from "./measure-draw.mjs"; import { measureSlice, rangeOf } from "./measure-slice.mjs"; import { measureExtraGeometry, measurePlacements, PROMISE_STRIP_PX, promiseStripRect, promiseStripType } from "./measure-extras.mjs"; import { placementsFor, promiseFinaleSlot, promiseHtml } from "./chrome-measure-extras.mjs"; import { validateFinaleSettings } from "./finale.mjs"; const HERE = path.dirname(fileURLToPath(import.meta.url)); const DIAL = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8")); const EXTRAS = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-extras", "measure.json"), "utf8")); const PAL = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }; const render = (deck = {}) => ({ width: 1920, height: 1080, fps: 30, transition: 0.4, palette: PAL, chrome: { engine: "hyperframes", layout: "deck", deck } }); const clone = (v) => JSON.parse(JSON.stringify(v)); /** A deck cut of nine clips (the last the finale) with `measure` in its schedule. */ function cut(r, measure = DIAL) { 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 manifest = { slug: "m", title: "M", provenance: {}, render: r, timeline }; return { manifest, schedule: { ...estimateSchedule(manifest), measure } }; } test("A: with a measure the instruments are ON unless they say otherwise; without one, only when named", () => { const withMeasure = render({ measure: { scopes: ["weight"] } }); assert.ok(resolveDial(withMeasure) && resolveOdometer(withMeasure) && resolveTrail(withMeasure)); assert.equal(instrumentsOn(withMeasure), true, "the column is on"); assert.equal(resolveDial(render({ measure: { scopes: ["weight"] }, dial: false })), null, "false is off"); assert.equal(resolveDial(render({})), null, "no measure, not named: off (a cut without them is the cut it was)"); assert.ok(resolveDial(render({ dial: true }))); assert.deepEqual(validateChrome(withMeasure.chrome, withMeasure), []); }); test("B: before he states a weight the dial says so in words, its needle parked at the foot, dimmed -- never a number", () => { const r = render({ dial: true }); const { schedule } = cut(r); const html = dialHtml(schedule, r, { fonts: {} }); assert.match(html, /NO WEIGHT
STATED YET/); const data = JSON.parse(/