test(web): update paint-order guard for the drawScriptRun refactor

The family-aware CanvasKit change added a `family` param to drawText and
moved the browser/system-font fallback fast path into the shared
`drawScriptRun` helper. Re-anchor the 'fallback before Paint allocation'
assertion on drawScriptRun where that invariant now lives.
This commit is contained in:
Kayshen-X 2026-07-05 19:18:47 +08:00
parent 3b19a16055
commit 4210fccabb

View file

@ -160,20 +160,24 @@ fn canvaskit_browser_text_fallback_does_not_require_canvas_paint() {
);
}
let draw_text = source
.find("drawText(t, x, y, sz, weight, italic, r, g, b, a)")
.expect("drawText bridge exists");
let fallback_fast_path = source[draw_text..]
// The browser/system-font fallback fast path (which returns before any
// CanvasKit Paint is allocated) lives in the shared `drawScriptRun`
// helper that `drawText` — and the uncovered segments of a family-aware
// run — delegate to.
let script_run = source
.find("const drawScriptRun = (t, x, y, sz, weight, italic, r, g, b, a) =>")
.expect("drawScriptRun helper exists");
let fallback_fast_path = source[script_run..]
.find("if (allSegmentsUseBrowserTextFallback(segs))")
.expect("browser text fast path exists")
+ draw_text;
let fill_paint = source[draw_text..]
+ script_run;
let fill_paint = source[script_run..]
.find("const p = fillPaint(r, g, b, a);")
.expect("CanvasKit paint fallback exists")
+ draw_text;
+ script_run;
assert!(
fallback_fast_path < fill_paint,
"drawText must take the browser/system font path before allocating CanvasKit Paint"
"drawScriptRun must take the browser/system font path before allocating CanvasKit Paint"
);
}