An open source design system that's fully customizable and agent ready
TypeScript
test(interaction-harness): a marker read under a pixel (#10475)
Christopher Chedeau376dadba54e7
diff --git a/internal/interaction-harness/README.md b/internal/interaction-harness/README.mdindex 0ebdad97cf..ce7876dea0 100644--- a/internal/interaction-harness/README.md+++ b/internal/interaction-harness/README.md@@ -186,7 +186,19 @@ in the cast's own position steps, read from the cast (`castStep`, from theby another color carries none, and `castStep` refuses it): 1 px in Chromium's PNG cast and 2 px inWebKit's JPEG cast, whose 4:2:0 chroma holds the marker's color in 2 by 2pixel blocks and so makes the tail's plateaus longer. Two steps stop at the-same tail in either engine while a freeze further from rest is still judged. A judged part shorter than four of the+same tail in either engine while a freeze further from rest is still judged.++Motion slower than two whole pixels a frame needs a finer read. In Chromium,+`trackMarker(page, frames, {subpixel: true})` reads the marker under a pixel+from its anti-aliased edges: a 10 px slide over 60 frames read 0.164 to 0.169+px a frame, where it moves 0.167 px, and a box at rest between pixels read the+same value on every frame. Each frame then carries `SUBPIXEL_STEP_PX`+(0.05 px) as its step, and the proof counts a change from half of it. The+marker must be opaque on a plain background. Use the default chip marker: an+outline marker's window holds the element's own content. WebKit's JPEG cast+holds color in 2 by 2 pixel blocks, so the read throws there.++A judged part shorter than four of thescreencast's intervals fails: the animation under test was not moving duringthe block. One that had already settled when the judged part began (nothing inthe window to judge) throws `BusyWindowTooLateError`, with the numbers: thediff --git a/internal/interaction-harness/src/busy.test.ts b/internal/interaction-harness/src/busy.test.tsindex 6b4810957e..0135cfa82b 100644--- a/internal/interaction-harness/src/busy.test.ts+++ b/internal/interaction-harness/src/busy.test.ts@@ -12,7 +12,10 @@* fails a 40 ms freeze more than two steps from rest in either cast. The* proof reads a held frame at its run's own pace, whatever the settle* bound. A slow spring late in a WebKit block passes, and its holds and a- * freeze still fail.+ * freeze still fail. A sub-pixel read judges every frame of a slow slide+ * that a whole-pixel read shows as stalls, and still fails a freeze. Against+ * a control, a frame delivered early on such a slide misses on a+ * whole-pixel read and moves on a sub-pixel one.* @position Unit test of ./busy and ./frames' ordering; the browser proof* with a real compositor animation and a rAF control is in* harness.interaction.browser.spec.ts.@@ -25,7 +28,11 @@ import * as skip from './busy.skip.fixture';import * as slowTail from './busy.slowtail.fixture';import * as webkitDecel from './busy.webkitdecel.fixture';import * as webkitTail from './busy.webkittail.fixture';-import {inPresentationOrder, type TrackedFrame} from './frames';+import {+ inPresentationOrder,+ SUBPIXEL_STEP_PX,+ type TrackedFrame,+} from './frames';const FRAME = 1000 / 60;const BLOCK = {from: 1000, to: 1700};@@ -1157,3 +1164,138 @@ describe('busyWindowProof settledWithinSteps', () => {).toThrow(/no tracked frame carries the cast's step/);});});++describe('busyWindowProof on a sub-pixel read', () => {+ /**+ * A marker sliding `pxPerFrame` from t = 800 to 1900, read as `trackMarker`+ * reads it: under a pixel with `subpixel`, else in whole pixels.+ */+ const slide = (pxPerFrame: number, subpixel: boolean): TrackedFrame[] =>+ moving().map((f, i) => {+ const y = pxPerFrame * i;+ return {+ ...f,+ box: {...f.box!, y: subpixel ? y : Math.round(y)},+ step: subpixel+ ? {x: SUBPIXEL_STEP_PX, y: SUBPIXEL_STEP_PX}+ : {x: 1, y: 1},+ } as TrackedFrame;+ });++ it('judges every frame of a slide under a pixel a frame, which a whole-pixel read shows as stalls', () => {+ // 0.2 px a frame: each change is under the 0.25 px a whole-pixel read+ // counts from.+ const fine = busyWindowProof(slide(0.2, true), BLOCK, {axis: 'y'});+ expect(fine.verdict.failures, fine.summary).toEqual([]);+ expect(fine.stepPx).toBe(SUBPIXEL_STEP_PX);+ expect(fine.movedFraction).toBe(1);+ const whole = busyWindowProof(slide(0.2, false), BLOCK, {axis: 'y'});+ expect(whole.verdict.pass).toBe(false);+ expect(whole.verdict.failures.join('\n')).toMatch(/expected frames moved/);+ });++ it('still fails a slide that freezes for the block, read under a pixel', () => {+ const frozen = slide(0.2, true).map(f =>+ f.t >= BLOCK.from+ ? ({...f, box: {...f.box!, y: 0.2 * at(BLOCK.from)}} as TrackedFrame)+ : f,+ );+ const proof = busyWindowProof(frozen, BLOCK, {axis: 'y'});+ expect(proof.verdict.pass).toBe(false);+ expect(proof.moved).toBe(0);+ });++ it('counts a change from half the read step, so jitter under it is no motion', () => {+ // 0.02 px of jitter around a position that holds: no frame moves.+ const jitter = slide(0, true).map(+ (f, i) =>+ ({...f, box: {...f.box!, y: i % 2 === 0 ? 0 : 0.02}}) as TrackedFrame,+ );+ const proof = busyWindowProof(jitter, BLOCK, {axis: 'y'});+ expect(proof.moved).toBe(0);+ expect(proof.verdict.pass).toBe(false);+ });+});++describe('busyWindowProof against a control, on a sub-pixel read', () => {+ /**+ * A slide of 0.4 px a frame, with one frame delivered 3 ms after frame 20.+ * It is read in whole pixels or under a pixel, beside the control's frames.+ */+ const earlyFrame = (+ subpixel: boolean,+ freeze?: {from: number; to: number},+ ) => {+ const times: number[] = [];+ for (let i = 0; 800 + i * FRAME <= 1900; i += 1) {+ times.push(800 + i * FRAME);+ if (i === 20) {+ times.push(800 + i * FRAME + 3);+ }+ }+ const position = (t: number) => {+ const held =+ freeze != null && t >= freeze.from+ ? Math.min(t, freeze.to) - freeze.from+ : 0;+ return (0.4 * (t - 800 - held)) / FRAME;+ };+ const tracked = times.map(+ t =>+ ({+ t,+ box: {+ x: 0,+ y: subpixel ? position(t) : Math.round(position(t)),+ width: 10,+ height: 10,+ },+ step: subpixel+ ? {x: SUBPIXEL_STEP_PX, y: SUBPIXEL_STEP_PX}+ : {x: 1, y: 1},+ }) as TrackedFrame,+ );+ const control = times.map(+ t =>+ ({+ t,+ box: {+ x: Math.round((3 * (t - 800)) / FRAME),+ y: 0,+ width: 12,+ height: 12,+ },+ }) as TrackedFrame,+ );+ return {tracked, control};+ };++ it('reads a frame delivered early as moved, which a whole-pixel read misses', () => {+ const whole = earlyFrame(false);+ const wholeProof = busyWindowProof(whole.tracked, BLOCK, {+ axis: 'y',+ control: whole.control,+ });+ expect(wholeProof.verdict.failures).toContain(+ 'moved on 37 of the 40 frames the control moved (93%)',+ );+ const fine = earlyFrame(true);+ const fineProof = busyWindowProof(fine.tracked, BLOCK, {+ axis: 'y',+ control: fine.control,+ });+ expect(fineProof.verdict.failures, fineProof.summary).toEqual([]);+ });++ it('still fails a slide that holds for five frames inside the block', () => {+ const held = earlyFrame(true, {from: 1300, to: 1300 + 5 * FRAME});+ const proof = busyWindowProof(held.tracked, BLOCK, {+ axis: 'y',+ control: held.control,+ });+ expect(proof.verdict.pass).toBe(false);+ expect(proof.verdict.failures.join('\n')).toMatch(+ /moved on \d+ of the \d+ frames the control moved/,+ );+ });+});diff --git a/internal/interaction-harness/src/busy.ts b/internal/interaction-harness/src/busy.tsindex ac3922df27..bfbcb9b4e7 100644--- a/internal/interaction-harness/src/busy.ts+++ b/internal/interaction-harness/src/busy.ts@@ -662,6 +662,7 @@ export interface BusyProof extends FrameStats {* The cast's position step, CSS px: the largest of 0.5, 1 and 2 that every* change of the tracked value in the judged part is a multiple of, or 0.5* when it does not change there (WebKit's casts step 2: see the README).+ * A sub-pixel read (`trackMarker` with `subpixel`) uses its own step.*/readonly stepPx: number;/** The tracked value's mean motion per screencast interval in the judged part, px. */@@ -993,6 +994,15 @@ export function busyWindowProof('busyWindowProof: give settledWithin or settledWithinSteps, not both',);}+ // A sub-pixel read (`trackMarker` with `subpixel`) shows changes far under+ // a pixel. There a change counts from half its step; on a whole-pixel read,+ // from 0.25 px.+ const readStepPx = tracked.some(f => f.step != null)+ ? castStep(tracked, axis)+ : null;+ const subpixelStepPx =+ readStepPx != null && readStepPx < 0.5 ? readStepPx : null;+ const epsilon = subpixelStepPx == null ? 0.25 : subpixelStepPx / 2;// The cast's own position step, for a proof that bounds its settle in it.const castStepPx =settledWithinSteps == null ? null : castStep(tracked, axis);@@ -1070,7 +1080,7 @@ export function busyWindowProof(if (v.value != null &&previous != null &&- Math.abs(v.value - previous) > 0.25+ Math.abs(v.value - previous) > epsilon) {inWindow.push(v.t);}@@ -1091,7 +1101,7 @@ export function busyWindowProof(});const lead = prior.flatMap(f => (f.box == null ? [] : [f.box[axis]]));const movedBefore = lead.some(- (value, i) => i > leadFrom && Math.abs(value - lead[i - 1]) > 0.25,+ (value, i) => i > leadFrom && Math.abs(value - lead[i - 1]) > epsilon,);// Held from before the block to its first presented change inside it: in// WebKit a just-started compositor animation is presented late (a sheet's@@ -1105,7 +1115,7 @@ export function busyWindowProof(let holdStart = lead.length - 1;while (holdStart > 0 &&- Math.abs(lead[holdStart - 1] - lead[lead.length - 1]) <= 0.25+ Math.abs(lead[holdStart - 1] - lead[lead.length - 1]) <= epsilon) {holdStart -= 1;}@@ -1116,15 +1126,14 @@ export function busyWindowProof(v =>v.value != null &&v.t < (inWindow[0] ?? -Infinity) &&- Math.abs(v.value - lead[lead.length - 1]) <= 0.25,+ Math.abs(v.value - lead[lead.length - 1]) <= epsilon,).length;// A late hand-off holds the page's last position. An animation that froze// at the block's start holds a position of its own. Within one cast step:// WebKit's cast reads positions on a 2 px grid, so a held position can read- // up to a step off. A cast with no step is read within a pixel.- const matchPx = tracked.some(f => f.step != null)- ? castStep(tracked, axis)- : 1;+ // up to a step off. A cast with no step is read within a pixel, and a+ // sub-pixel read within half a pixel.+ const matchPx = subpixelStepPx != null ? 0.5 : (readStepPx ?? 1);const heldFromBeforeBlock =setBeforeBlock != null &&lead.length > 0 &&@@ -1155,6 +1164,7 @@ export function busyWindowProof(const stats = frameStats(tracked.map(f => ({t: f.t, value: f.box == null ? null : f.box[axis]})),judged,+ epsilon,);const cadence =intervals.length >= 4@@ -1253,14 +1263,16 @@ export function busyWindowProof(: deliveredFrames;const movedFraction = (moved + recorderSkipped) / Math.max(1, judgedFrames);// The cast's position step for the tracked value, read from the judged- // part.- const stepPx = motionStepPx(- tracked.flatMap(f =>- f.box != null && f.t >= judged.from && f.t <= judged.to- ? [f.box[axis]]- : [],- ),- );+ // part. A sub-pixel read carries its own.+ const stepPx =+ subpixelStepPx ??+ motionStepPx(+ tracked.flatMap(f =>+ f.box != null && f.t >= judged.from && f.t <= judged.to+ ? [f.box[axis]]+ : [],+ ),+ );const judgedValues = tracked.flatMap(f =>f.box != null && f.t >= judged.from && f.t <= judged.to? [{t: f.t, value: f.box[axis]}]@@ -1322,7 +1334,7 @@ export function busyWindowProof();const seriesIndex = new Map(series.map((f, i) => [f.t, i]));const same = (a: number, b: number) =>- Math.abs(series[a].value - series[b].value) <= 0.25;+ Math.abs(series[a].value - series[b].value) <= epsilon;// The first frame of the run of equal positions that holds frame i.const runStart = (i: number): number => {let s = i;diff --git a/internal/interaction-harness/src/frames.ts b/internal/interaction-harness/src/frames.tsindex f6d1b4fdc3..f8b8b4518e 100644--- a/internal/interaction-harness/src/frames.ts+++ b/internal/interaction-harness/src/frames.ts@@ -19,6 +19,8 @@* Marker tracking needs no image library: frames are decoded and scanned in a* scratch page of the same browser (createImageBitmap + canvas), so the* harness adds no dependency.+ * With `subpixel`, the read places the marker under a pixel, from its+ * anti-aliased edges (Chromium's PNG cast).** SYNC: Keep the README's frame-evidence section equal to what this measures.*/@@ -302,11 +304,21 @@ export interface TrackedFrame {* WebKit's JPEG cast, whose 4:2:0 chroma holds color in 2 by 2 pixel* blocks, and 1 px in Chromium's PNG cast, both at the viewport's size.* Another color carries none: a cyan control in the same WebKit frames- * moves by odd px.+ * moves by odd px. A sub-pixel read (`subpixel`) carries its own step,+ * `SUBPIXEL_STEP_PX`, whatever the color.*/readonly step?: {readonly x: number; readonly y: number};}+/**+ * The step of a sub-pixel marker read, CSS px. On Chromium's PNG cast, a+ * layer that a transform puts between pixels shows anti-aliased edges. The+ * read places the marker from them. A 10 px slide over 60 frames read 0.164+ * to 0.169 px a frame, where it moves 0.167 px. Identical frames read+ * identical positions. The step sits well above that spread.+ */+export const SUBPIXEL_STEP_PX = 0.05;+/*** The bitmap pixels per block of a cast frame's color resolution, per axis:* 1 for a PNG; for a JPEG, its chroma subsampling, read from the frame header@@ -356,6 +368,14 @@ export function colorBlockPx(* browser, so neither the page under test nor Node needs an image decoder.* With `region` (CSS px), only that part of each frame is searched. On a* loaded machine, a search of every pixel can take longer than the test.+ *+ * With `subpixel`, the box comes from the marker's anti-aliased edges, not+ * its whole pixels. Each pixel near the marker counts by its color's share of+ * the way from the background to the marker's color. The box sits on the+ * centroid of those weights. The background is read from a ring 2 px outside+ * the marker, so the marker must be opaque on a plain background. Use the+ * default chip marker: an outline marker's window holds the element's own+ * content. Only a PNG cast keeps those edges: a JPEG frame throws.*/export async function trackMarker(page: Page,@@ -364,16 +384,19 @@ export async function trackMarker(rgb = MARKER_RGB,tolerance = 40,region,+ subpixel = false,}: {rgb?: readonly [number, number, number];tolerance?: number;region?: Box;+ subpixel?: boolean;} = {},): Promise<TrackedFrame[]> {const [tracked] = await trackMarkers(page, frames, {colors: [rgb],tolerance,region,+ subpixel,});return tracked;}@@ -390,12 +413,19 @@ export async function trackMarkers(colors,tolerance = 40,region,+ subpixel = false,}: {colors: readonly (readonly [number, number, number])[];tolerance?: number;region?: Box;+ subpixel?: boolean;},): Promise<TrackedFrame[][]> {+ if (subpixel && frames.some(f => f.format !== 'png')) {+ throw new Error(+ "trackMarkers: subpixel needs a PNG cast; a JPEG frame's chroma blocks hide the marker's edges",+ );+ }const isDefaultMarker = colors.map(rgb =>rgb.every((value, i) => value === MARKER_RGB[i]),);@@ -406,7 +436,7 @@ export async function trackMarkers(for (let i = 0; i < frames.length; i += 12) {const batch = frames.slice(i, i + 12);const results = await scratch.evaluate(- async ({batch: items, palette, tol, area}) => {+ async ({batch: items, palette, tol, area, sub}) => {const found: {boxes: ({x: number;@@ -483,16 +513,91 @@ export async function trackMarkers(}}}+ // The marker's box from its anti-aliased edges: each pixel counts+ // by its color's share of the way from the background to the+ // marker's. The background is the median of a ring 2 px out.+ const fine = (c: number) => {+ const x0 = Math.max(0, minX[c] - 2);+ const x1 = Math.min(width - 1, maxX[c] + 2);+ const y0 = Math.max(0, minY[c] - 2);+ const y1 = Math.min(height - 1, maxY[c] + 2);+ const ring: number[][] = [[], [], []];+ for (let y = y0; y <= y1; y += 1) {+ for (let x = x0; x <= x1; x += 1) {+ if (x === x0 || x === x1 || y === y0 || y === y1) {+ const o = (y * width + x) * 4;+ for (let k = 0; k < 3; k += 1) {+ ring[k].push(data[o + k]);+ }+ }+ }+ }+ const background = ring.map(values => {+ const sorted = values.sort((a, b) => a - b);+ return sorted[Math.floor(sorted.length / 2)];+ });+ const toward = palette[c].map((v, k) => v - background[k]);+ const span = toward.reduce((sum, v) => sum + v * v, 0);+ if (span < 30 * 30) {+ throw new Error(+ `trackMarkers: the marker's color lies within ${Math.sqrt(span).toFixed(0)} of its background, too close to read under a pixel`,+ );+ }+ let total = 0;+ let sumX = 0;+ let sumY = 0;+ const rows: number[] = [];+ const columns = new Array<number>(x1 - x0 + 1).fill(0);+ for (let y = y0; y <= y1; y += 1) {+ let row = 0;+ for (let x = x0; x <= x1; x += 1) {+ const o = (y * width + x) * 4;+ let dot = 0;+ for (let k = 0; k < 3; k += 1) {+ dot += (data[o + k] - background[k]) * toward[k];+ }+ const weight = Math.min(1, Math.max(0, dot / span));+ total += weight;+ sumX += weight * (x + 0.5);+ sumY += weight * (y + 0.5);+ row += weight;+ columns[x - x0] += weight;+ }+ if (y > minY[c] && y < maxY[c]) {+ rows.push(row);+ }+ }+ const median = (values: number[], fallback: number) => {+ if (values.length === 0) {+ return fallback;+ }+ const sorted = [...values].sort((a, b) => a - b);+ return sorted[Math.floor(sorted.length / 2)];+ };+ const markerWidth = median(rows, maxX[c] - minX[c] + 1);+ const markerHeight = median(+ columns.filter((_, i) => x0 + i > minX[c] && x0 + i < maxX[c]),+ maxY[c] - minY[c] + 1,+ );+ return {+ x: (left + sumX / total - markerWidth / 2) / scale,+ y: (top + sumY / total - markerHeight / 2) / scale,+ width: markerWidth / scale,+ height: markerHeight / scale,+ };+ };found.push({boxes: palette.map((_, c) =>pixels[c] === 0? null- : {- x: (left + minX[c]) / scale,- y: (top + minY[c]) / scale,- width: (maxX[c] - minX[c] + 1) / scale,- height: (maxY[c] - minY[c] + 1) / scale,- },+ : sub+ ? fine(c)+ : {+ x: (left + minX[c]) / scale,+ y: (top + minY[c]) / scale,+ width: (maxX[c] - minX[c] + 1) / scale,+ height: (maxY[c] - minY[c] + 1) / scale,+ },),pixels,scale,@@ -509,6 +614,7 @@ export async function trackMarkers(palette: colors.map(rgb => [...rgb]),tol: tolerance,area: region ?? null,+ sub: subpixel,},);results.forEach((result, k) => {@@ -517,18 +623,28 @@ export async function trackMarkers(: null;colors.forEach((_, c) => {out[c].push(- isDefaultMarker[c] && block != null+ subpixel? {t: batch[k].t,box: result.boxes[c],pixels: result.pixels[c],- step: {x: block.x / result.scale, y: block.y / result.scale},+ step: {x: SUBPIXEL_STEP_PX, y: SUBPIXEL_STEP_PX},}- : {- t: batch[k].t,- box: result.boxes[c],- pixels: result.pixels[c],- },+ : isDefaultMarker[c] && block != null+ ? {+ t: batch[k].t,+ box: result.boxes[c],+ pixels: result.pixels[c],+ step: {+ x: block.x / result.scale,+ y: block.y / result.scale,+ },+ }+ : {+ t: batch[k].t,+ box: result.boxes[c],+ pixels: result.pixels[c],+ },);});});diff --git a/internal/interaction-harness/src/harness.interaction.browser.spec.ts b/internal/interaction-harness/src/harness.interaction.browser.spec.tsindex e19a90a759..b7ff32bc56 100644--- a/internal/interaction-harness/src/harness.interaction.browser.spec.ts+++ b/internal/interaction-harness/src/harness.interaction.browser.spec.ts@@ -61,6 +61,7 @@ import {animationStoryboard,castStoryboard,blockMainThread,+ BUSY_PROOF_LOOKAROUND_MS,busyWindowProof,BusyWindowTooLateError,castStep,@@ -105,6 +106,7 @@ import {startScreencast,startBusyControl,Storyboard,+ SUBPIXEL_STEP_PX,tap,thawPage,thawTimers,@@ -715,6 +717,112 @@ test.describe('frame evidence', () => {await control.remove();});+ test('a sub-pixel read follows a compositor slide under a pixel a frame through a blocked main thread; a rAF slide still fails', async ({+ page,+ browserName,+ }) => {+ test.skip(+ browserName !== 'chromium',+ "WebKit's JPEG cast holds color in 2 by 2 pixel blocks, so it cannot read under a pixel",+ );+ await busyFixture(page);+ const box = page.locator('#box');+ // A chip on the box's plain face: the read takes the background there.+ await markElement(box);+ const control = await startBusyControl(page);+ // At rest between pixels, the read holds still: the control keeps the cast+ // sending frames meanwhile.+ await box.evaluate(el => {+ el.style.transform = 'translateY(10.37px)';+ });+ // The cast's first frame can be the last one the compositor drew: start+ // it once frames have shown the box at its new place.+ await frames(page, 3);+ const restCast = await startScreencast(page);+ await frames(page, 20);+ const atRest = (+ await trackMarker(page, await restCast.stop(), {subpixel: true})+ ).flatMap(f => (f.box == null ? [] : [f.box.y]));+ expect(atRest.length).toBeGreaterThan(5);+ const spread = Math.max(...atRest) - Math.min(...atRest);+ test.info().annotations.push({+ type: 'sub-pixel read at rest',+ description: `${atRest.length} frames, spread ${spread.toFixed(4)} px`,+ });+ expect(spread).toBeLessThan(SUBPIXEL_STEP_PX / 5);+ // 36 px in 2 s is 0.3 px a frame at 60 Hz. A whole-pixel read shows a+ // new position on about one frame in three.+ const run = async (driver: 'compositor' | 'raf') => {+ const cast = await startScreencast(page);+ await box.evaluate((el, how) => {+ el.getAnimations().forEach(a => a.cancel());+ el.style.transform = 'none';+ if (how === 'compositor') {+ el.animate(+ [{transform: 'translateY(0px)'}, {transform: 'translateY(36px)'}],+ {duration: 2000, easing: 'linear'},+ );+ } else {+ const start = performance.now();+ const step = (now: number) => {+ const p = Math.min(1, (now - start) / 2000);+ el.style.transform = `translateY(${36 * p}px)`;+ if (p < 1) {+ requestAnimationFrame(step);+ }+ };+ requestAnimationFrame(step);+ }+ }, driver);+ // A rendering update first commits the cancel of the run before.+ await page.evaluate(+ () =>+ new Promise<void>(resolve =>+ requestAnimationFrame(() => requestAnimationFrame(() => resolve())),+ ),+ );+ const window = await blockMainThread(+ page,+ 600,+ driver === 'compositor' ? {during: box} : {},+ );+ await page.waitForTimeout(200);+ const shown = (await cast.stop()).filter(+ f => f.t <= window.to + BUSY_PROOF_LOOKAROUND_MS,+ );+ const controlFrames = await trackControl(page, shown);+ const judge = async (subpixel: boolean) =>+ busyWindowProof(await trackMarker(page, shown, {subpixel}), window, {+ axis: 'y',+ control: controlFrames,+ });+ return {fine: await judge(true), whole: await judge(false), shown};+ };++ const {fine, whole, shown} = await run('compositor');+ expect(fine.verdict.failures, fine.summary).toEqual([]);+ expect(fine.stepPx).toBe(SUBPIXEL_STEP_PX);+ expect(fine.pxPerFrame, fine.summary).toBeGreaterThan(0.2);+ expect(fine.pxPerFrame, fine.summary).toBeLessThan(0.4);+ // Every frame the read judged shows a new position; the same frames read+ // in whole pixels show one on fewer than half of them.+ expect(fine.moved, fine.summary).toBeGreaterThanOrEqual(+ fine.deliveredFrames - 1,+ );+ expect(whole.changed, whole.summary).toBeLessThan(fine.changed / 2);++ const {fine: raf} = await run('raf');+ expect(raf.verdict.pass, raf.summary).toBe(false);+ expect(raf.verdict.failures.join('\n')).toMatch(+ /moved on [01] of the \d+ frames the control moved/,+ );+ // A JPEG frame hides the marker's edges in its chroma blocks.+ await expect(+ trackMarker(page, [{...shown[0], format: 'jpeg'}], {subpixel: true}),+ ).rejects.toThrow(/needs a PNG cast/);+ await control.remove();+ });+test('frames the screencast skips while the compositor presents them are not a stall; a frozen animation still fails with the compositor record', async ({page,browserName,