Commit 2363488
committed
fonts: add tests for fallback font lookup w/ system ui font
...we're probably not supposed to be accessing system fonts this way.
when running the tests w/o my first fix (clearing restrictions for system font):
```
[I] ➜ ghostty git:(upstream-3) ✗ zig build test -Dtest-filter="discoverFallback"
test
└─ run ghostty-test 59/60 passed, 1 failed
error: 'font.discovery.test.coretext discoverFallback CJK codepoint' failed: 2025-09-10 13:53:31.792 ghostty-test[51978:12386835] CoreText note: Client requested name ".PingFangUITextSC-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2025-09-10 13:53:31.792 ghostty-test[51978:12386835] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
/opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/testing.zig:580:14: 0x10575e86f in expect (ghostty-test)
if (!ok) return error.TestUnexpectedResult;
^
/Users/cheru/Code/ghostty/src/font/discovery.zig:1133:5: 0x10577445f in test.coretext discoverFallback CJK codepoint (ghostty-test)
try testing.expect(face.hasCodepoint(0x4E2D, null));
^
error: while executing test 'os.TempDir.test_0', the following test command failed:
/Users/cheru/Code/ghostty/.zig-cache/o/d8ac3a9ccf171ecb22ca38e4e30bc420/ghostty-test --seed=0x9fe58469 --cache-dir=/Users/cheru/Code/ghostty/.zig-cache --listen=-
Build Summary: 49/51 steps succeeded; 1 failed; 59/60 tests passed; 1 failed
test transitive failure
└─ run ghostty-test 59/60 passed, 1 failed
error: the following build command failed with exit code 1:
/Users/cheru/Code/ghostty/.zig-cache/o/526a4ea34f8d95eb90ea2f3856ac80e8/build /opt/homebrew/Cellar/zig/0.14.1/bin/zig /opt/homebrew/Cellar/zig/0.14.1/lib/zig /Users/cheru/Code/ghostty /Users/cheru/Code/ghostty/.zig-cache /Users/cheru/.cache/zig --seed 0x9fe58469 -Z70fd58e5d3dc4a11 test -Dtest-filter=discoverFallback
```1 parent 93d020e commit 2363488
1 file changed
+76
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
1053 | 1055 | | |
1054 | 1056 | | |
1055 | 1057 | | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
0 commit comments