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:
ddidderr committed 2026-10-12 17:23:24 +02:00
1 parent b95aae16ae
commit a8d0d624da
30 files changed
+1668 -240

No files matched your search

+23 -5
View File
@@ -381,9 +381,14 @@ mod tests {
);
let mut d = DiagnosticList::default();
assert!(open(&e("/tmp"), None, &mut d).is_none());
// Windows cannot open a directory as a file (AccessDenied).
assert_eq!(
d.items()[0].message,
"not reading theme from \"/tmp\": it is a directory"
if cfg!(windows) {
"failed to load theme from the path \"/tmp\": error.AccessDenied"
} else {
"not reading theme from \"/tmp\": it is a directory"
}
);
}
@@ -469,7 +474,11 @@ mod tests {
let mut d = DiagnosticList::default();
assert!(open(&e(name), Some(&EncodedOs::from_path(&dir)), &mut d).is_none());
assert!(
d.items()[0].message.ends_with("it is a directory"),
d.items()[0].message.ends_with(if cfg!(windows) {
"error.AccessDenied"
} else {
"it is a directory"
}),
"{}",
d.items()[0].message
);
@@ -484,7 +493,10 @@ mod tests {
std::fs::write(dir.join("themes/mytheme-zzz"), "background = #000000\n").unwrap();
let mut d = DiagnosticList::default();
let t = open(&e("mytheme-zzz"), Some(&EncodedOs::from_path(&dir)), &mut d).unwrap();
assert!(t.path.ends_with_plain("themes/mytheme-zzz"));
assert!(
t.path
.ends_with_plain(&format!("themes{}mytheme-zzz", std::path::MAIN_SEPARATOR))
);
assert!(d.is_empty());
std::fs::remove_dir_all(&dir).unwrap();
}
@@ -493,7 +505,13 @@ mod tests {
fn theme_not_found_lists_tried_paths() {
let mut d = DiagnosticList::default();
assert!(open(&e("nope-zzz"), Some(&e("/nonexistent-res")), &mut d).is_none());
assert!(d.items().iter().any(|x| x.message
== "theme \"nope-zzz\" not found, tried path \"/nonexistent-res/themes/nope-zzz\""));
let tried = std::path::Path::new("/nonexistent-res")
.join("themes")
.join("nope-zzz");
let want = format!(
"theme \"nope-zzz\" not found, tried path \"{}\"",
tried.display()
);
assert!(d.items().iter().any(|x| x.message == want));
}
}