test(windows): run the Windows code under Wine; theme preview parity
Windows was previously only compile-checked. With Wine 11 (staging) and mingw available, scripts/windows-wine-test.sh (`just test-windows-wine`) builds expat/FreeType/fontconfig for mingw under target/wine-deps and runs the test suites of ghostty-vt, unicode, datastruct, input, os, config, terminal, crash, termio and cli under Wine (~2,700 tests). New termio/tests/exec_windows.rs drives real cmd.exe children over ConPTY through Termio (output, exit codes, typing, 120 KiB writes, stop, start failure). Fixes found: Windows paths from fs::canonicalize leaked the \\?\ prefix (new ghostty_os::path::realpath strips it like Zig); ghostty-font compiles hb-ft for bundled HarfBuzz on Windows; ~25 tests had Unix assumptions. Wine limitations are ignored with reasons (ResizePseudoConsole stub, no POSIX rename over existing files) - docs/rewrite/notes/windows-wine.md. +list-themes preview parity (former KNOWN_DIFFERENCES rows 5-9): the search box ports vaxis TextInput (word navigation and editing bindings, grapheme-wise editing), ASCII-only case folding, light initial colors until terminal reports arrive (no COLORFGBG), and load errors end the preview with exit 1; PTY tests compare with /usr/bin/ghostty. Test Plan: - just test-windows-wine - cargo test -p ghostty-cli --test list_themes_pty - cargo test --workspace --no-fail-fast (3601 passed)
This commit is contained in:
1 parent
b95aae16ae
commit
a8d0d624da
30 files changed
+1668
-240
No files matched your search
@@ -47,6 +47,10 @@ objc2-core-graphics = "0.3.2"
|
||||
objc2-core-text = "0.3.2"
|
||||
objc2-foundation = "0.3.2"
|
||||
|
||||
# Compiles `hb-ft.cc` for the bundled HarfBuzz on Windows (see build.rs).
|
||||
[build-dependencies]
|
||||
cc = "1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
# CoreText for discovery, FreeType for rendering, HarfBuzz for shaping
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
build_harfbuzz_freetype_glue();
|
||||
for c in [
|
||||
"font_freetype",
|
||||
"font_fontconfig",
|
||||
@@ -77,3 +78,50 @@ fn main() {
|
||||
on("font_coretext_shaper", coretext && !harfbuzz && !ct_noshape);
|
||||
on("font_noshape", coretext && !harfbuzz && ct_noshape);
|
||||
}
|
||||
|
||||
/// The bundled HarfBuzz (`harfbuzz-sys` `bundled`, used on Windows where there
|
||||
/// is no system copy) is compiled without `HAVE_FREETYPE`, so `hb_ft_*` is
|
||||
/// missing. Zig builds HarfBuzz with FreeType enabled (`pkg/harfbuzz`
|
||||
/// `-DHAVE_FREETYPE=1`), so compile `hb-ft.cc` against the bundled FreeType
|
||||
/// headers here.
|
||||
fn build_harfbuzz_freetype_glue() {
|
||||
use std::path::PathBuf;
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
|
||||
return;
|
||||
}
|
||||
let Some(hb_src) = std::env::var_os("DEP_HARFBUZZ_INCLUDE").map(PathBuf::from) else {
|
||||
return;
|
||||
};
|
||||
// `<registry>/harfbuzz-sys-X/harfbuzz/src` -> `<registry>/freetype-sys-*/freetype2/include`.
|
||||
let Some(registry) = hb_src.ancestors().nth(3) else {
|
||||
return;
|
||||
};
|
||||
let ft_include = std::fs::read_dir(registry)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.flatten()
|
||||
.map(|e| e.path())
|
||||
.filter(|p| {
|
||||
p.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.is_some_and(|n| n.starts_with("freetype-sys-"))
|
||||
})
|
||||
.map(|p| p.join("freetype2").join("include"))
|
||||
.find(|p| p.join("ft2build.h").exists());
|
||||
let Some(ft_include) = ft_include else {
|
||||
println!("cargo:warning=bundled FreeType headers not found; hb_ft_* will be missing");
|
||||
return;
|
||||
};
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cpp(true)
|
||||
.flag_if_supported("-std=c++11")
|
||||
.warnings(false)
|
||||
.define("HAVE_FREETYPE", "1")
|
||||
.include(&hb_src)
|
||||
.include(&ft_include)
|
||||
.file(hb_src.join("hb-ft.cc"));
|
||||
if std::env::var("TARGET").is_ok_and(|t| t.contains("windows-gnu")) {
|
||||
cfg.flag("-Wa,-mbig-obj");
|
||||
}
|
||||
cfg.compile("ghostty_hb_ft");
|
||||
}
|
||||
Reference in new issue
Block a user