mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 05:33:38 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dd0dc509d |
No files matched your search
@@ -9,16 +9,18 @@ import { bookkeeping } from "./naming.ts"
|
||||
|
||||
type Said = { check?: string; level?: string; says?: string; fix?: string | null; frames?: [number, number] | null }
|
||||
|
||||
/** what the floor pack measures again on the video itself (the app's UI zones): read there, not twice */
|
||||
/** what the floor pack measures again on the video itself (the app's UI zones): read there, not twice, when the floor
|
||||
* pack runs; a goal without it (rules, a scene, a playable) keeps the render's own line (12-06: a desktop title card's
|
||||
* render found SUNMELT in the right-hand button zone, and its kept check said nothing) */
|
||||
const MEASURED_AGAIN = new Set(["safe-area"])
|
||||
|
||||
/** the manifest's findings, one a kind: the first of each (by check and level), with how many more there were */
|
||||
export function renderFindings(manifest: unknown): Said[] {
|
||||
export function renderFindings(manifest: unknown, floorRuns = true): Said[] {
|
||||
const all = ((manifest as { findings?: Said[] } | null)?.findings ?? []).filter((x) => x && (x.level === "error" || x.level === "warn"))
|
||||
const firsts = new Map<string, Said & { more: number }>()
|
||||
for (const x of all) {
|
||||
const k = x.check ?? "render"
|
||||
if (MEASURED_AGAIN.has(k)) continue
|
||||
if (floorRuns && MEASURED_AGAIN.has(k)) continue
|
||||
const key = `${k} ${x.level}`
|
||||
const had = firsts.get(key)
|
||||
if (had) had.more++
|
||||
@@ -27,8 +29,14 @@ export function renderFindings(manifest: unknown): Said[] {
|
||||
return [...firsts.values()].map((x) => ({ ...x, says: `${x.check ?? "render"}: ${x.says ?? ""}${x.more ? ` (and ${x.more} more like it)` : ""}` }))
|
||||
}
|
||||
|
||||
export default check<FileFacts>({ id: "render", text: "nothing the render's own end checks found", over: "file", at: ["render", "publish", "done"] }, async (f) => {
|
||||
if (!f.made || bookkeeping(f.path) || !f.manifest) return
|
||||
for (const x of renderFindings(f.manifest))
|
||||
found({ level: x.level as "error" | "warn", says: x.says ?? "", fix: x.fix ?? undefined, frames: x.frames ?? undefined })
|
||||
})
|
||||
const renderPack = (floorRuns: boolean) =>
|
||||
check<FileFacts>({ id: "render", text: "nothing the render's own end checks found", over: "file", at: ["render", "publish", "done"] }, async (f) => {
|
||||
if (!f.made || bookkeeping(f.path) || !f.manifest) return
|
||||
for (const x of renderFindings(f.manifest, floorRuns))
|
||||
found({ level: x.level as "error" | "warn", says: x.says ?? "", fix: x.fix ?? undefined, frames: x.frames ?? undefined })
|
||||
})
|
||||
|
||||
/** beside the floor pack, which measures the app's UI zones on the video itself */
|
||||
export default renderPack(true)
|
||||
/** with no floor pack to measure them: the render's own UI-zone lines kept */
|
||||
export const renderAlone = renderPack(false)
|
||||
+5
-1
@@ -20,6 +20,7 @@ import { fileFacts, type FileFacts, type Job, kindOf, runIn } from "./facts.ts"
|
||||
import * as media from "./media.ts"
|
||||
import { loadProject, type Project } from "./project.ts"
|
||||
import { PACK_CHECKS } from "./packs/index.ts"
|
||||
import { renderAlone } from "./packs/render.ts"
|
||||
import { deliverablesOf } from "./packs/job.ts"
|
||||
import { bookkeeping } from "./packs/naming.ts"
|
||||
import { placeReport } from "./packs/place.ts"
|
||||
@@ -144,7 +145,10 @@ function madeUnder(root: string): string[] {
|
||||
|
||||
/** the checks that hold a goal at a moment: its packs', then its own */
|
||||
export function checksOf(contract: Contract | null, at: Moment, only?: string[]): Check[] {
|
||||
const all = [...packsOf(contract).flatMap((p) => PACK_CHECKS[p]), ...((contract?.checks ?? []) as Check[])]
|
||||
const packs = packsOf(contract)
|
||||
// the render's own UI-zone lines are the floor pack's to measure when it runs, else the render pack keeps them
|
||||
const of = (p: (typeof packs)[number]) => (p === "render" && !packs.includes("floor") ? [renderAlone as Check] : PACK_CHECKS[p])
|
||||
const all = [...packs.flatMap(of), ...((contract?.checks ?? []) as Check[])]
|
||||
const seen = new Set<string>()
|
||||
return all.filter((c) => {
|
||||
if (!c?.id || seen.has(c.id) || !c.once) return false
|
||||
|
||||
@@ -3,8 +3,8 @@ import { expect, test } from "bun:test"
|
||||
import { mkdtempSync, utimesSync, writeFileSync } from "node:fs"
|
||||
import { tmpdir } from "node:os"
|
||||
import path from "node:path"
|
||||
import { renderFindings } from "../src/packs/render.ts"
|
||||
import { collapse, keptCheck } from "../src/run.ts"
|
||||
import { renderAlone, renderFindings } from "../src/packs/render.ts"
|
||||
import { checksOf, collapse, keptCheck } from "../src/run.ts"
|
||||
|
||||
const at = (s: number, says = "a caption under the app's buttons") => ({ goal: null, check: "floor", file: "a.mp4", level: "error" as const, says, seconds: [s, s + 1] as [number, number] })
|
||||
|
||||
@@ -38,6 +38,16 @@ test("CK2: the render's own findings, one line a kind; safe-area is measured on
|
||||
expect(said[0].says).toBe("font-missing: Inter isn't installed (and 1 more like it)")
|
||||
})
|
||||
|
||||
test("CK2b: with no floor pack to measure the app's buttons, the render's own safe-area line is kept (12-06)", () => {
|
||||
const m = { findings: [{ check: "safe-area", level: "warn", says: "SUNMELT sits in the app's UI zone at the right" }] }
|
||||
expect(renderFindings(m, false).map((x) => x.says)).toEqual(["safe-area: SUNMELT sits in the app's UI zone at the right"])
|
||||
// a title card's goal (rules) holds no floor pack, so its render pack keeps the line; a cut's holds both, and drops it
|
||||
const ids = (c: any) => checksOf(c, "render").filter((k) => k.id === "render" || k.id === "floor").map((k) => k.id)
|
||||
expect(ids({ kind: "rules", rules: [] })).toEqual(["render"])
|
||||
expect(checksOf({ kind: "rules", rules: [] } as any, "render").find((k) => k.id === "render")).toBe(renderAlone as any)
|
||||
expect(checksOf({ kind: "cut" } as any, "render").find((k) => k.id === "render")).not.toBe(renderAlone as any)
|
||||
})
|
||||
|
||||
test("CK3: one line a rule a file across levels: the worst leads, the rest counted under it (12-05, run 5)", () => {
|
||||
const f = (level: string, check: string, s: number, says: string) => ({ goal: "g", check, file: "out/cuts/a.mp4", level, says, seconds: [s, s + 1], fix: null, by: "raea" })
|
||||
const xs = collapse([f("warn", "place", 3.5, "text covers a person"), f("error", "place", 0, "text covers a dog"), f("warn", "frames", 4, "face cut by the bottom edge"), f("error", "frames", 3, "face cut by the right edge"), f("warn", "sound", 8.8, "a tight cut"), f("error", "sound", 14.1, "cuts a word")] as never)
|
||||
|
||||
Reference in new issue
Block a user