You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
examples/ has no *_test.go files. The example programs ship with detailed doc comments listing required system fonts and platform-specific expectations, but nothing exercises them end-to-end. Issue #227 was effectively the user being our CI for examples/cjk/main.go:
The example's doc comment said it works on Windows with msyh.ttc and Ubuntu with NotoSansCJK-Regular.ttc
Both paths hit the TTC-dispatch bug
The example was tested on macOS, where findCJKFont() happens to return Arial Unicode.ttf (a TTF, not a TTC)
Nobody caught it until a Windows user ran it
Proposal
Add a test per example that:
Compiles and runs the example with a synthetic / minimal-system fixture (reuse the loadAnySystemTTF + buildSyntheticTTC helpers that landed for CJK fail render some Chinese Characters. #227)
Asserts the produced PDF starts with %PDF- and embeds the requested font (BaseFont check)
Skips cleanly when no compatible fixture is available, rather than skipping silently the whole thing
Sketch:
// examples/cjk/main_test.gofuncTestCJKExampleProducesValidPDF(t*testing.T) {
iftesting.Short() { t.Skip(\"exampletest (use-tagsexamplestoenableindefaultruns)\") }
// Stub findCJKFont to return a synthetic TTC built from a Latin TTF, so// the test runs on any host. Or use os.Setenv to point findCJKFont at// a fixture path.// Run main(), capture stdout, assert cjk.pdf starts with %PDF- and// includes the requested @font-face PostScript name as BaseFont.
}
Some examples may need a small refactor (extract buildHTML + findCJKFont from main() so tests can call them directly without re-running os.Exit).
Scope suggestion
Phase 1: examples/cjk (the one #227 reported). Phase 2: roll out to other examples on the same template (examples/fonts, examples/zugferd, examples/sign).
Problem
examples/has no*_test.gofiles. The example programs ship with detailed doc comments listing required system fonts and platform-specific expectations, but nothing exercises them end-to-end. Issue #227 was effectively the user being our CI forexamples/cjk/main.go:msyh.ttcand Ubuntu withNotoSansCJK-Regular.ttcfindCJKFont()happens to returnArial Unicode.ttf(a TTF, not a TTC)Proposal
Add a test per example that:
loadAnySystemTTF+buildSyntheticTTChelpers that landed for CJK fail render some Chinese Characters. #227)%PDF-and embeds the requested font (BaseFont check)Sketch:
Some examples may need a small refactor (extract
buildHTML+findCJKFontfrommain()so tests can call them directly without re-runningos.Exit).Scope suggestion
Phase 1:
examples/cjk(the one #227 reported). Phase 2: roll out to other examples on the same template (examples/fonts,examples/zugferd,examples/sign).Acceptance criteria