commit 24ad8d8dad2d904afaaa5596b123bf3633d2a7cb
parent eeac4a1b832af6968e4618003af17deee0b4685f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 12:53:06 -0500
umtool: a diet tag's word fits its tag; Play's shelf e2e reads the tags left to right
The first proof render printed "CARNIVO…" on its tag: the condensed
extra-bold face set in capitals and spaced runs ~0.62 em a letter, not the
stamp's 0.52, and the room is the tag less its plate, border and padding
(176 design px). tagWordSize now sizes by that ("CARNIVORE" 31 px, "KETO"
44); a test pins both. play-measure.spec's shelf test sorts the visible tags
by where they stand (the page holds them in the order they came in).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/umtool/e2e/play-measure.spec.ts b/umtool/e2e/play-measure.spec.ts
@@ -102,3 +102,51 @@ test("the measure extras play in Play the cut, each page seeked to the playhead'
expect(await shown(page, "promise")).toBeNull();
await page.screenshot({ path: test.info().outputPath("play-measure-c02.png") });
});
+
+test("on the shelf: the footage at the frame's top, the diet's dated tags and the streak in the strip under it, seeked as before", async ({ page, request }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ const enc = encodeURIComponent;
+ const read = async () => (await (await request.get(`/api/report/chrome?project=${enc(PROJECT)}`)).json()) as { chrome: Record<string, any>; token: string };
+ const put = async (chrome: unknown) => {
+ const { token } = await read();
+ const r = await request.put("/api/report/chrome", { data: { project: PROJECT, chrome, token } });
+ expect(r.ok(), await r.text()).toBeTruthy();
+ };
+ const before = (await read()).chrome;
+ const deck = before.deck ?? {};
+ try {
+ await put({
+ ...before,
+ deck: { ...deck, shelf: { items: ["diet", "streak"] }, diet: { ...(deck.diet ?? {}), position: "shelf" }, streak: { ...(deck.streak ?? {}), position: "shelf" } },
+ });
+ await page.goto(urls.playHref(PROJECT, { clip: "c04", at: 1 }));
+ await ready(page);
+ // Where Play laid them, in % of the frame: the footage from 24 px down, the shelf's slots at y 750 of 1080.
+ const top = (sel: string) => page.locator(sel).first().evaluate((el) => parseFloat((el as HTMLElement).style.top));
+ expect(await top("[data-play-footage]")).toBeCloseTo((24 / 1080) * 100, 1);
+ for (const id of ["diet", "streak"]) expect(await top(`[data-testid="play-layer-${id}"]`)).toBeCloseTo((750 / 1080) * 100, 1);
+ // The tags: the newest (carnivore, c03) and keto (c01) under it, each with the day he named it.
+ const tags = () =>
+ page.frameLocator('[data-testid="play-layer-diet-iframe"]').locator("#pn").evaluate((pn) =>
+ [...pn.querySelectorAll<HTMLElement>(".tg")]
+ .filter((e) => getComputedStyle(e).visibility !== "hidden" && Number(getComputedStyle(e).opacity) > 0.5)
+ // Left to right, as they stand on the shelf (the page holds them in the order they came in).
+ .sort((a, b) => a.getBoundingClientRect().left - b.getBoundingClientRect().left)
+ .map((e) => (e.textContent ?? "").replace(/\s+/g, " ").trim()));
+ await expect.poll(tags, { timeout: 10_000 }).toHaveLength(2);
+ const [newest, older] = await tags();
+ expect(newest).toContain("Carnivore");
+ expect(older).toContain("Keto");
+ for (const t of [newest, older]) expect(t).toMatch(/[A-Z][a-z]{2} \d{1,2}, \d{4}/);
+ expect(await shown(page, "streak")).toContain("Carnivore");
+ await page.screenshot({ path: test.info().outputPath("play-measure-shelf.png") });
+ // Back into c02: one tag, keto.
+ await expect(root(page)).toHaveAttribute("data-play-state", "paused");
+ await page.getByRole("button", { name: "−5" }).click();
+ await expect(root(page)).toHaveAttribute("data-play-item", "c02");
+ await expect.poll(tags, { timeout: 10_000 }).toHaveLength(1);
+ expect((await tags())[0]).toContain("Keto");
+ } finally {
+ await put(before);
+ }
+});
diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs
@@ -682,10 +682,14 @@ export function dietHtml(schedule, render, opts = {}) {
return { html: page("diet", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`), render), items };
}
-/** A tag's regime word a size that fits its width: the condensed face at ~0.52 em a letter. */
-export function tagWordSize(label, room = DIET_TAG.width - 40) {
+/**
+ * A tag's regime word a size that fits its width (`room`, design px: the tag
+ * less its plate, border and padding): the condensed extra-bold face set in
+ * capitals and spaced, at ~0.62 em a letter ("CARNIVORE" 31 px, "KETO" 44).
+ */
+export function tagWordSize(label, room = DIET_TAG.width - 44) {
const n = Math.max(1, [...String(label)].length);
- return Math.max(18, Math.min(44, Math.floor(room / (0.52 * n))));
+ return Math.max(16, Math.min(44, Math.floor(room / (0.62 * n))));
}
/**
@@ -755,7 +759,7 @@ function dietTagsHtml(schedule, render, opts, cfg, states) {
});
const { cues } = compileCues(init, ev);
const items = [];
- const room = DIET_TAG.width - 40;
+ const room = DIET_TAG.width - 44;
const blocks = [...tags.values()].map((t) => {
const k = `t${t.id}`;
const d = t.diet;
diff --git a/umtool/report-to-video/shelf.test.mjs b/umtool/report-to-video/shelf.test.mjs
@@ -10,7 +10,7 @@ import path from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
-import { dietHtml } from "./chrome-measure-extras.mjs";
+import { dietHtml, tagWordSize } from "./chrome-measure-extras.mjs";
import { shelfHtml, shelfNoteGeometry } from "./chrome-shelf.mjs";
import { deckGeometry, entryShelfNotes, estimateSchedule, instrumentsGeometry, parseShelfNote, validateChrome } from "./deck.mjs";
import { dietStates, measureExtraGeometry, measurePlacements, shelfLayout } from "./measure-extras.mjs";
@@ -140,6 +140,9 @@ test("the diet's tags: each change pushes a dated tag in at the front, the oldes
assert.match(html, /<div class="dt">Feb 6, 2018<\/div>/);
assert.match(html, /data-k="t0\.s"/);
assert.match(html, /\.tg \{ position: absolute; left: 0; top: 0; width: 220px; height: 116px;/);
+ // The regime's word fits its tag: CARNIVORE a size down, KETO at the top size.
+ assert.equal(tagWordSize("Keto"), 44);
+ assert.equal(tagWordSize("Carnivore"), 31);
});
test("the shelf's note: an entry's shelfNote over its span, only with the shelf on; its own page in the slot left", () => {