From dd1fd439d4820108ebfd4c80b2c92a51b46c5ef4 Mon Sep 17 00:00:00 2001 From: BFlat Date: Sat, 10 Oct 2026 02:05:58 +0700 Subject: [PATCH] M4: components test: check the hugging instance only when its text was measured (#1) Without craft-fonts (CI) the overridden text keeps its size, so the old guard (`width > 0`) asserted a hug that could never happen and failed main's CI. Co-authored-by: Claude Opus 5.5 --- crates/engine/src/components_tests.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/components_tests.rs b/crates/engine/src/components_tests.rs index 9c5b718..773985d 100644 --- a/crates/engine/src/components_tests.rs +++ b/crates/engine/src/components_tests.rs @@ -373,8 +373,11 @@ fn resized_instances_follow_constraints_and_auto_layout() { let ci = idv(&ex(&mut s, "instance.create", json!({"component": chip, "x": 300, "y": 600}))); let w0 = node(&s, ci).width; let it = copy_of(&s, ci, t); + let tw0 = node(&s, it).width; ex(&mut s, "text.set", json!({"id": it, "characters": "A much longer chip label"})); - if figcraft_text::find_face("Inter", "Regular").is_some() || node(&s, it).width > 0.0 { + // Without a measurable font (CI has no craft-fonts) the text keeps its size; only check the + // hug when the text actually grew. + if node(&s, it).width > tw0 { assert!(node(&s, ci).width > w0, "auto layout instance hugs its overridden text"); } healthy(&s);