mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-02 02:36:14 -06:00
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:
co-authored by
Claude Opus 5.5
parent
c53cefd4d6
commit
36d9eb2a61
@@ -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>
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user