From fecb7149e46c6f42af3a7972d53eb45b142b14e3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 14:45:07 -0800 Subject: [PATCH] Tests: each Show Hidden Characters retry sets new text show_hidden_characters_lays_out_only_type_that_changed retries its two frames when another test changes the fonts or the hyphenation exceptions between them. Every retry set the same text, which after the first attempt is no edit, so the object kept its marks and the test failed with "the edited object is laid out again". Each attempt now sets different text. --- crates/ui-egui/src/canvas/tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index d5dfe4e307..a5ee4dfb0a 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -5831,8 +5831,12 @@ fn show_hidden_characters_lays_out_only_type_that_changed() { let same = |a: &std::sync::Arc, b: &std::sync::Arc| std::sync::Arc::ptr_eq(a, b); let (before, after) = frames(&mut app, &|_| {}); assert!(before.iter().zip(&after).all(|(a, b)| same(a, b)), "a frame lays out no type"); + // Each attempt sets different text: text the object already has is no edit, and a second + // attempt with the same text would leave the object as it was. + let edits = std::cell::Cell::new(0); let (before, after) = frames(&mut app, &|app| { - app.session.execute("text.setText", &json!({"id": ids[1].0, "text": "a b c"})).unwrap(); + edits.set(edits.get() + 1); + app.session.execute("text.setText", &json!({"id": ids[1].0, "text": format!("a b c {}", edits.get())})).unwrap(); }); assert!(!same(&before[1], &after[1]), "the edited object is laid out again"); assert!(same(&before[0], &after[0]) && same(&before[2], &after[2]), "the others are not");