시각 골든은 작성자 PC가 고른 글꼴 4종(Noto Sans, Noto Sans CJK KR Regular·Black, Liberation Mono)으로 찍혀 있는데, 설정은 글꼴을 고정하지 않는다. 같은 dist에서 FONTCONFIG_FILE만 Playwright가 맨 Ubuntu에 까는 글꼴 구성으로 바꿔도 5장이 모두 실패한다. 실패는 화면 전체가 밀린 pixel diff라서 원인이 글꼴이라는 것을 알기 어렵다. CI 러너도 같은 처지다. 고른 방법 (리뷰 4.1절 c′, 사용자 결정): - tests/visual/fonts.conf가 Debian/Ubuntu 경로의 세 디렉터리 (truetype/noto, opentype/noto, truetype/liberation)만 보이게 한다. playwright.visual.config.ts가 use.launchOptions.env로 그 파일을 FONTCONFIG_FILE에 넣는다. 바깥 FONTCONFIG_FILE은 덮어쓴다. CI workflow는 바꾸지 않았다. - 같은 파일에서 래스터 설정(antialias, hintslight, rgb, lcddefault, autohint 끔)을 호스트 규칙 뒤에 고정한다. 글꼴 이름이 같아도 hint와 sub-pixel 기본값이 다른 호스트에서는 5장이 모두 실패했다(검증 참고). - visual-fonts setup 프로젝트(tests/visual/fonts.setup.ts)를 chromium-visual의 의존으로 둔다. 실제 앱 페이지에 탐침 요소를 넣고 CDP CSS.getPlatformFontsForNode로 실제로 그려진 글꼴을 비교한다. 다르면 설치할 패키지 이름과 함께 실패하고, 스크린샷 테스트는 돌지 않는다. 글꼴이 하나도 없으면 렌더러가 죽으므로 그 경우도 같은 안내로 감싼다. test:visual:update도 같은 검사를 먼저 거친다. 버린 대안: - fc-match 사전 검사: fontconfig CLI가 러너에 있다는 보장이 없고, Chromium이 실제로 고르는 글꼴과 다를 수 있다. 앱 페이지의 code는 Liberation Mono인데, lang 없는 빈 페이지에서는 Noto Mono가 잡혔다. 그래서 탐침도 앱 페이지 안에 넣는다. - document.fonts.check: 시스템 글꼴은 없어도 true를 돌려준다. - /etc/fonts/conf.d를 빼고 별칭 규칙을 직접 쓰기: system-ui와 Courier New(Chromium 기본 monospace) 해석을 다시 만들어야 한다. 리뷰 실험 D(호스트 규칙 포함, 5/5)에서 벗어난다. - 컨테이너 이미지, 글꼴 파일 커밋, 임계값 완화: 리뷰 4.1절에서 기각. 위험·한계: - 바이트가 아니라 패키지 이름을 고정한다. 배포판이 글꼴 버전을 바꾸면 이름 검사는 통과하고 pixel diff로 실패할 수 있다. - generic family 별칭(sans-serif → Noto Sans, Courier New → Liberation Mono)은 호스트의 /etc/fonts/conf.d를 따른다. 별칭이 다른 호스트 (예: Noto Sans를 우선하지 않는 fontconfig 2.14 미만)에서는 visual-fonts가 실패한다. 조용히 다른 글꼴로 바뀌지는 않는다. - 사용자 fontconfig(50-user.conf)가 디렉터리를 더하면 그 글꼴도 보인다. 탐침 4종이 바뀌면 검사가 잡는다. - Linux 전용이다. macOS와 Windows의 Chromium은 fontconfig를 읽지 않는다. - 실제 Gitea 러너에서는 돌려 보지 못했다(U-1). CI에 apt 설치 단계를 넣지 않았고, 필요한 패키지는 테스트 전략 문서 13.4절에 적었다. - 골든은 다시 찍지 않았다. 검증 (같은 dist, flock, `npx playwright test --config playwright.visual.config.ts`. pnpm을 부르지 않으려고 webServer만 vite preview로 바꾼 로컬 사본으로 실행): - 수정 전, 바깥 FONTCONFIG_FILE=A(Playwright Ubuntu 글꼴 + DejaVu): 5 failed, toHaveScreenshot diff(46,356 px, 4%) - 검사만 넣고 같은 A: 1 failed, 5 did not run. 설치 안내와 함께 latin=DejaVu Sans, korean=WenQuanYi Zen Hei - RED, fonts.conf가 빈 디렉터리만 볼 때: 1 failed, 5 did not run. 같은 설치 안내 + "The font probe page did not render" - GREEN, 호스트 환경: 6 passed. 바깥 A: 6 passed(기존 골든 5/5) - 러너 근사(호스트 conf.d에서 language-selector, ubuntulegacy, sub-pixel-rgb 제외): 6 passed - 다른 래스터 기본값(hinting-full, sub-pixel-none): 고정 블록 없이 5 failed(setup만 통과, diff 2%), 고정 블록 포함 6 passed - tsc(app·node·test), eslint, check-test-evidence --source-only PASS, verify-documentation-readiness PASS_SCOPED, vitest supply-chain과 tests/architecture 53 passed Refs: docs/reviews/2026-11-01-maturity-review/11-tests-browser-release-scale.md 11-02, 4.1절
38 lines
1.7 KiB
XML
38 lines
1.7 KiB
XML
<?xml version="1.0"?>
|
|
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
|
<!--
|
|
11-02. Font set for the visual tests (playwright.visual.config.ts passes it
|
|
to Chromium as FONTCONFIG_FILE). The goldens were captured with Noto Sans,
|
|
Noto Sans CJK KR (Regular and Black) and Liberation Mono, so Chromium sees
|
|
only the directories that hold them, at their Debian/Ubuntu paths:
|
|
|
|
sudo apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
|
|
|
|
A missing directory is skipped silently here; tests/visual/fonts.setup.ts
|
|
fails the run with that install line instead. Linux only: Chromium on macOS
|
|
and Windows does not read fontconfig.
|
|
-->
|
|
<fontconfig>
|
|
<dir>/usr/share/fonts/truetype/noto</dir>
|
|
<dir>/usr/share/fonts/opentype/noto</dir>
|
|
<dir>/usr/share/fonts/truetype/liberation</dir>
|
|
<cachedir>/var/cache/fontconfig</cachedir>
|
|
<cachedir prefix="xdg">fontconfig</cachedir>
|
|
|
|
<!-- The host's generic-family aliases: sans-serif to Noto Sans, Courier
|
|
New (Chromium's default monospace) to Liberation Mono. -->
|
|
<include ignore_missing="yes">/etc/fonts/conf.d</include>
|
|
|
|
<!-- Rasterization the goldens were captured with. Placed after the host
|
|
rules so a runner whose fontconfig defaults differ (sub-pixel order,
|
|
hint style) still draws the same pixels. -->
|
|
<match target="font">
|
|
<edit name="antialias" mode="assign"><bool>true</bool></edit>
|
|
<edit name="hinting" mode="assign"><bool>true</bool></edit>
|
|
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
|
|
<edit name="autohint" mode="assign"><bool>false</bool></edit>
|
|
<edit name="rgba" mode="assign"><const>rgb</const></edit>
|
|
<edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
|
|
</match>
|
|
</fontconfig>
|