mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 05:33:38 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0134c591c3 |
No files matched your search
@@ -9,18 +9,16 @@ import { bookkeeping } from "./naming.ts"
|
|||||||
|
|
||||||
type Said = { check?: string; level?: string; says?: string; fix?: string | null; frames?: [number, number] | null }
|
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, when the floor
|
/** what the floor pack measures again on the video itself (the app's UI zones): read there, not twice */
|
||||||
* 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"])
|
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 */
|
/** 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, floorRuns = true): Said[] {
|
export function renderFindings(manifest: unknown): Said[] {
|
||||||
const all = ((manifest as { findings?: Said[] } | null)?.findings ?? []).filter((x) => x && (x.level === "error" || x.level === "warn"))
|
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 }>()
|
const firsts = new Map<string, Said & { more: number }>()
|
||||||
for (const x of all) {
|
for (const x of all) {
|
||||||
const k = x.check ?? "render"
|
const k = x.check ?? "render"
|
||||||
if (floorRuns && MEASURED_AGAIN.has(k)) continue
|
if (MEASURED_AGAIN.has(k)) continue
|
||||||
const key = `${k} ${x.level}`
|
const key = `${k} ${x.level}`
|
||||||
const had = firsts.get(key)
|
const had = firsts.get(key)
|
||||||
if (had) had.more++
|
if (had) had.more++
|
||||||
@@ -29,14 +27,8 @@ export function renderFindings(manifest: unknown, floorRuns = true): Said[] {
|
|||||||
return [...firsts.values()].map((x) => ({ ...x, says: `${x.check ?? "render"}: ${x.says ?? ""}${x.more ? ` (and ${x.more} more like it)` : ""}` }))
|
return [...firsts.values()].map((x) => ({ ...x, says: `${x.check ?? "render"}: ${x.says ?? ""}${x.more ? ` (and ${x.more} more like it)` : ""}` }))
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPack = (floorRuns: boolean) =>
|
export default check<FileFacts>({ id: "render", text: "nothing the render's own end checks found", over: "file", at: ["render", "publish", "done"] }, async (f) => {
|
||||||
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
|
if (!f.made || bookkeeping(f.path) || !f.manifest) return
|
||||||
for (const x of renderFindings(f.manifest, floorRuns))
|
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 })
|
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)
|
|
||||||
+1
-5
@@ -20,7 +20,6 @@ import { fileFacts, type FileFacts, type Job, kindOf, runIn } from "./facts.ts"
|
|||||||
import * as media from "./media.ts"
|
import * as media from "./media.ts"
|
||||||
import { loadProject, type Project } from "./project.ts"
|
import { loadProject, type Project } from "./project.ts"
|
||||||
import { PACK_CHECKS } from "./packs/index.ts"
|
import { PACK_CHECKS } from "./packs/index.ts"
|
||||||
import { renderAlone } from "./packs/render.ts"
|
|
||||||
import { deliverablesOf } from "./packs/job.ts"
|
import { deliverablesOf } from "./packs/job.ts"
|
||||||
import { bookkeeping } from "./packs/naming.ts"
|
import { bookkeeping } from "./packs/naming.ts"
|
||||||
import { placeReport } from "./packs/place.ts"
|
import { placeReport } from "./packs/place.ts"
|
||||||
@@ -145,10 +144,7 @@ function madeUnder(root: string): string[] {
|
|||||||
|
|
||||||
/** the checks that hold a goal at a moment: its packs', then its own */
|
/** 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[] {
|
export function checksOf(contract: Contract | null, at: Moment, only?: string[]): Check[] {
|
||||||
const packs = packsOf(contract)
|
const all = [...packsOf(contract).flatMap((p) => PACK_CHECKS[p]), ...((contract?.checks ?? []) as Check[])]
|
||||||
// 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>()
|
const seen = new Set<string>()
|
||||||
return all.filter((c) => {
|
return all.filter((c) => {
|
||||||
if (!c?.id || seen.has(c.id) || !c.once) return false
|
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 { mkdtempSync, utimesSync, writeFileSync } from "node:fs"
|
||||||
import { tmpdir } from "node:os"
|
import { tmpdir } from "node:os"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import { renderAlone, renderFindings } from "../src/packs/render.ts"
|
import { renderFindings } from "../src/packs/render.ts"
|
||||||
import { checksOf, collapse, keptCheck } from "../src/run.ts"
|
import { 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] })
|
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,16 +38,6 @@ 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)")
|
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)", () => {
|
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 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)
|
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)
|
||||||
|
|||||||
+1
-1
Submodule skills updated: 7f083c16ac...d8a0dc738e.
@@ -132,12 +132,6 @@ fn insets(parts: &[Part]) -> Vec<Option<usize>> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether `inner` lies wholly in `outer`'s box (within a millimetre): what `outer` holds, never what it stands on.
|
|
||||||
fn holds(outer: &Part, inner: &Part) -> bool {
|
|
||||||
let e = Vec3::splat(0.001);
|
|
||||||
inner.lo.cmpge(outer.lo - e).all() && inner.hi.cmple(outer.hi + e).all()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rest_of(parts: &[Part], grid: &Grid, insets: &[Option<usize>], i: usize) -> Rest {
|
fn rest_of(parts: &[Part], grid: &Grid, insets: &[Option<usize>], i: usize) -> Rest {
|
||||||
let p = &parts[i];
|
let p = &parts[i];
|
||||||
let height = p.hi.y - p.lo.y;
|
let height = p.hi.y - p.lo.y;
|
||||||
@@ -153,9 +147,7 @@ fn rest_of(parts: &[Part], grid: &Grid, insets: &[Option<usize>], i: usize) -> R
|
|||||||
let mut col = grid.column(parts, f.x, f.z, i);
|
let mut col = grid.column(parts, f.x, f.z, i);
|
||||||
// a part and the wall it's set into don't stand on each other, nor do a wall's pieces (a corner, the wall over
|
// a part and the wall it's set into don't stand on each other, nor do a wall's pieces (a corner, the wall over
|
||||||
// a window)
|
// a window)
|
||||||
// nor does a part stand on what it holds: coffee in its mug, soil in its pot, a box's contents (12-06, the 3D
|
col.retain(|&(y, j, _)| y <= f.y + up && insets[i] != Some(j) && insets[j] != Some(i) && !(wall(p) && wall(&parts[j])));
|
||||||
// proof: "mug is sunk 12.0 mm into coffee", the coffee's top a floor's thickness above the mug's foot)
|
|
||||||
col.retain(|&(y, j, _)| y <= f.y + up && insets[i] != Some(j) && insets[j] != Some(i) && !(wall(p) && wall(&parts[j])) && !holds(p, &parts[j]));
|
|
||||||
let Some(&(y, j, k)) = col.iter().max_by(|a, b| a.0.total_cmp(&b.0)) else { continue };
|
let Some(&(y, j, k)) = col.iter().max_by(|a, b| a.0.total_cmp(&b.0)) else { continue };
|
||||||
let gap = f.y - y;
|
let gap = f.y - y;
|
||||||
tested += 1;
|
tested += 1;
|
||||||
|
|||||||
@@ -170,19 +170,3 @@ fn a_thing_left_in_the_air_is_an_error_unless_it_glows_or_is_floating() {
|
|||||||
let (_, level, _, errors) = air(json!({}), json!({"emissive": {"red": 2200.0, "green": 120.0, "blue": 80.0, "alpha": 1.0}}));
|
let (_, level, _, errors) = air(json!({}), json!({"emissive": {"red": 2200.0, "green": 120.0, "blue": 80.0, "alpha": 1.0}}));
|
||||||
assert_eq!((level.as_str(), errors), ("note", 0));
|
assert_eq!((level.as_str(), errors), ("note", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_mug_stands_on_the_table_not_on_its_coffee() {
|
|
||||||
let floor = part("floor", Vec3::new(0.0, -0.05, 0.0), Vec3::new(4.0, 0.1, 4.0));
|
|
||||||
let mug = part("mug", Vec3::new(0.3, 0.05, 0.2), Vec3::new(0.08, 0.1, 0.08));
|
|
||||||
// the coffee in it: its top 12 mm above the mug's foot, wholly inside the mug's box
|
|
||||||
let coffee = part("coffee", Vec3::new(0.3, 0.007, 0.2), Vec3::new(0.06, 0.01, 0.06));
|
|
||||||
let parts = [floor, mug, coffee];
|
|
||||||
match rest(&parts, 1) {
|
|
||||||
Rest::On { under, gap, .. } => {
|
|
||||||
assert_eq!(parts[under].label, "floor");
|
|
||||||
assert!(gap.abs() <= TOUCH, "{gap}");
|
|
||||||
}
|
|
||||||
r => panic!("the mug should rest on the floor: {r:?}"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user