From 36d9eb2a618b33ff25e53f0af8af2899587d1411 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 30 Nov 2026 16:54:17 +0000 Subject: [PATCH] Tests: Unix font folders on Unix hosts; an old File view's save still completes The /nix and /usr entries of the font folder tests are absolute only on a Unix host; elsewhere the catalogue rightly skips or re-roots them. The backstage test also checks that the old view's save took effect, not only that the new view stayed open. Co-Authored-By: Claude Opus 5.5 --- crates/fonts/src/fontdb.rs | 9 ++++++--- crates/ui-egui/src/backstage/tests.rs | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/fonts/src/fontdb.rs b/crates/fonts/src/fontdb.rs index 4ad2e749a..e019785b7 100644 --- a/crates/fonts/src/fontdb.rs +++ b/crates/fonts/src/fontdb.rs @@ -1393,11 +1393,10 @@ impl OutlinePen for FlipPen { #[cfg(test)] mod font_dir_tests { - use std::path::Path; - use super::*; - fn assert_fixture_discovered_after_rescan(env: FontEnv, directory: &Path) { + #[cfg(unix)] + fn assert_fixture_discovered_after_rescan(env: FontEnv, directory: &std::path::Path) { let catalog = Arc::new(Catalog::new(env.clone()).with_font_service(false)); catalog.set_confined_dirs(vec![env.root]); let db = FontDb::with_catalog(catalog.clone(), CatalogScope::Isolated); @@ -1519,7 +1518,9 @@ mod font_dir_tests { assert_eq!(cache.elements, before); } + // The catalogue keeps only host-absolute XDG entries, and `/nix/…` is absolute only on a Unix host. #[test] + #[cfg(unix)] fn xdg_data_dirs_contribute_their_fonts_folders() { let root = std::env::temp_dir().join(format!("deckcraft-fonts-xdg-{}", std::process::id())); let _ = std::fs::remove_dir_all(&root); @@ -1541,7 +1542,9 @@ mod font_dir_tests { let _ = std::fs::remove_dir_all(root); } + // A `` of `/…` is absolute only on a Unix host; elsewhere it joins the configuration's folder. #[test] + #[cfg(unix)] fn fontconfig_dir_entries_are_read() { let conf = r#" diff --git a/crates/ui-egui/src/backstage/tests.rs b/crates/ui-egui/src/backstage/tests.rs index e727d92df..291df4534 100644 --- a/crates/ui-egui/src/backstage/tests.rs +++ b/crates/ui-egui/src/backstage/tests.rs @@ -400,6 +400,7 @@ fn host_save_as_under_the_same_name_returns_to_the_slide() { h.state().backstage.as_ref().is_some_and(|view| Arc::ptr_eq(&view.instance, &replacement)), "an old success cannot close a new File view" ); + assert!(h.state().session.active().unwrap().path.is_some(), "the old save still completed"); } #[test]