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 <noreply@anthropic.com>
This commit is contained in:
Dylan M. Taylor
2026-11-30 16:54:17 +00:00
co-authored by Claude Opus 5.5
parent c53cefd4d6
commit 36d9eb2a61
2 changed files with 7 additions and 3 deletions
+6 -3
View File
@@ -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 `<dir>` 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#"<?xml version="1.0"?>
<fontconfig>
+1
View File
@@ -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]