GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
test: the tests never read the machine's config
Six tests failed on the desktop and passed elsewhere, because every
config read in the crate went to the real ~/.config/cce:
- the three heightfield tests set a plate's rise, and the live
`relief edge height=1.5` pinned it (face 1.5, not 10);
- three material tests met the live frost radius (5.5, not 1.5),
plate blur on (a negative-alpha fill where opaque was expected) and
a menu compression.
Under cfg(test), config::config_home() is now a per-process directory
nobody creates. config.kdl, the per-app overrides and input.kdl all
resolve through it, so every getter answers its default; a test that
needs a setting loads it from a string, as the material tests already
do. Dependents' tests link the non-test build and are unaffected.
cce-ui's lib suite: 597/597 in three parallel runs and one at
--test-threads=1, with the live config in place; each of the six also
passes alone. Fonts are untouched: the text-shaping tests still need
the bundled faces (~/Dropbox/Fonts or $CCE_FONTS_DIR).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md | 8 ++++++++
src/config.rs | 15 +++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/CLAUDE.md b/CLAUDE.md
index 7d74848..ef529dc 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -57,6 +57,14 @@ scattering of widgets (`text_box`, `slider`, `dropdown`, `treelist`, …). When
engine, that module's tests are the fast feedback loop; run `cargo test -p cce-ui scene::` before
anything else.
+**The tests never read the machine's config** (since 2026-10-07). Under `cfg(test)`,
+`config::config_home()` is a per-process directory nobody creates, so `config.kdl`, the per-app
+overrides and `input.kdl` are all absent and every getter answers its default. A test that needs a
+setting loads it from a string (`color::reload_colors`) or pins it on its thread. Before this, six
+heightfield and material tests failed on the desktop, whose `relief edge height` and frost keys
+overrode what they set, and passed elsewhere. Fonts are another matter: `fonts_dir()` still reads
+`~/Dropbox/Fonts` (or `$CCE_FONTS_DIR`), and the text-shaping tests need those faces.
+
**The library also builds for the browser** (`wasm32-unknown-unknown`, since 2026-10-04):
`scripts/check-wasm` type-checks it, with and without the optional features. The native
shell and renderer — `vk`, the Wayland shell (`backend::{window_runner, menu_popup, dnd}`),
diff --git a/src/config.rs b/src/config.rs
index 0845eb3..af8788c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -539,7 +539,22 @@ pub fn update_kdl_in_memory_typed(doc: &mut kdl::KdlDocument, key: &str, value:
}
/// XDG config base directory: `$XDG_CONFIG_HOME`, else `~/.config`.
+///
+/// Under this crate's own tests it is a per-process directory nobody
+/// creates, so every config read (`config.kdl`, a per-app override,
+/// `input.kdl`) finds no file and the toolkit's defaults are what a test
+/// sees. Until 2026-10-07 the tests read the machine's `~/.config/cce`:
+/// six of them failed on the user's desktop (a `relief edge height` pinned
+/// the plate rise the heightfield tests set; the frost and blur keys moved
+/// the material ones) and passed on a machine without that config. A test
+/// that wants a configuration loads it from a string (`reload_colors`).
+/// Dependents' tests link the non-test build and are unaffected.
pub fn config_home() -> std::path::PathBuf {
+ #[cfg(test)]
+ {
+ return std::env::temp_dir().join(format!("cce-ui-test-config-{}", std::process::id()));
+ }
+ #[allow(unreachable_code)]
match std::env::var("XDG_CONFIG_HOME") {
Ok(x) if !x.is_empty() => std::path::PathBuf::from(x),
_ => std::path::PathBuf::from(std::env::var("HOME").unwrap_or_default()).join(".config"),