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 <noreply@anthropic.com>
This commit is contained in:
BFlat 2026-10-10 02:05:58 +07:00 committed by GitHub
parent 1608822632
commit dd1fd439d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -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);