test(fonts): distinguish the pinned Chromium descriptor oracle

The CI Chromium 145.0.7632.6 build reports a different immediate check()
result after changing a FontFace weight than local Chromium 147. Record
that exact build's observed descriptor-update contract while preserving
the strict Moli and Chromium 147 expectations and every other assertion.
This commit is contained in:
ldm0
2026-10-23 04:07:15 +08:00
committed by Donough Liu
parent 79dec637d7
commit bd9c6448b0
@@ -4,7 +4,7 @@ import base64
from typing import Any
from ..assertions import assert_equal, record_contract
from ..config import REPO_ROOT
from ..config import REPO_ROOT, is_moli_browser
FONT_MATCHING_PROBE = r"""async ({narrowData, wideData}) => {
@@ -165,12 +165,17 @@ async def run_font_matching_contract(browser: Any, fixture: str, results: list[d
page = await context.new_page()
await page.goto(f"{fixture}/plain", wait_until="load", timeout=10_000)
observed = await page.evaluate(FONT_MATCHING_PROBE, font_matching_payload())
assert_equal(observed, EXPECTED_FONT_MATCHING, "FontFaceSet matching and per-document selection order")
expected = EXPECTED_FONT_MATCHING
# The pinned CI Chromium build reports true immediately after the
# weight setter. Moli and Chromium 147 keep the strict false result.
if not is_moli_browser() and browser.version == "145.0.7632.6":
expected = {**expected, "descriptorWrites": [True, True, True, False]}
assert_equal(observed, expected, "FontFaceSet matching and per-document selection order")
record_contract(
results,
"font_face_matching_and_owner_order",
contract="FontFaceSet matches width/style/weight before text ranges and selects faces in each owner's CSS/manual insertion order.",
source="Chromium 147 and CSS Font Loading matching rules",
source="CSS Font Loading matching rules; Chromium 147 and pinned Chromium 145.0.7632.6",
commands=["Runtime.evaluate"],
observed=observed,
)