git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

tests/font_fallback.rs (647B)

 1 //! Regression test: a missing bundled-fonts dir must not produce an empty font
 2 //! database — cosmic-text panics with "no default font found" on the first
 3 //! shaped glyph (this is what crash-looped the cce-display-manager greeter,
 4 //! which runs as root with no $HOME/Dropbox/Fonts).
 5 
 6 #[test]
 7 fn empty_bundled_dir_falls_back_to_system_fonts() {
 8     std::env::set_var("CCE_FONTS_DIR", "/nonexistent-cce-fonts");
 9     std::env::remove_var("CCE_LOAD_SYSTEM_FONTS");
10     let fs = cce_ui::create_font_system();
11     assert!(
12         fs.db().faces().next().is_some(),
13         "font database is empty — system-font fallback did not kick in"
14     );
15 }