Shut eyes and backs no longer win a burst when an open-eyed face exists. Develop/crop runs only on the picked frames (not the whole sequence). Bursts without EXIF group by ingest time. Level falls back to LightCraft when stadium lines disagree.
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { sequenceWeight } from "./sequence.js";
|
|
|
|
describe("sequence choice", () => {
|
|
it("prefers a face to a back, and open eyes to shut ones, only when there is a choice", () => {
|
|
const weights = sequenceWeight([
|
|
{ facing: 0, eyes: 0.2 },
|
|
{ facing: 1, eyes: 0.8 },
|
|
]);
|
|
expect(weights[0]).toBeLessThan(0.05);
|
|
expect(weights[1]).toBe(1);
|
|
expect(sequenceWeight([{ facing: 0, eyes: null }])).toEqual([1]);
|
|
expect(sequenceWeight([{ facing: 1, eyes: 0.5 }, { facing: 1, eyes: 0.52 }])).toEqual([1, 1]);
|
|
});
|
|
|
|
it("never keeps a blink when the same burst has open eyes, even in a match", () => {
|
|
const frames = [
|
|
{ facing: 1 as const, eyes: 0.25 },
|
|
{ facing: 1 as const, eyes: 0.8 },
|
|
];
|
|
const match = sequenceWeight(frames);
|
|
const reportage = sequenceWeight(frames, true);
|
|
expect(match[0]!).toBeLessThanOrEqual(0.08);
|
|
expect(reportage[0]!).toBeLessThanOrEqual(0.05);
|
|
expect(match[1]).toBe(1);
|
|
expect(reportage[1]).toBe(1);
|
|
});
|
|
|
|
it("prefers open eyes over a grimace or a shot face when both are in the sequence", () => {
|
|
const weights = sequenceWeight([
|
|
{ facing: 1, eyes: 0.3 },
|
|
{ facing: 1, eyes: 0.7 },
|
|
{ facing: 1, eyes: 0.65 },
|
|
]);
|
|
expect(weights[0]!).toBeLessThan(weights[1]!);
|
|
expect(weights[0]!).toBeLessThan(weights[2]!);
|
|
});
|
|
});
|