SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
test: the agent chat's long-message layout check waits for agent detection (#3349)
bherbruck74af4a347112
diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rsindex dc81a3cf84..97bf629756 100644--- a/crates/ui-egui/src/agent_chat/tests.rs+++ b/crates/ui-egui/src/agent_chat/tests.rs@@ -1414,24 +1414,35 @@ fn an_agents_markdown_is_drawn_as_blocks() {}/// A long message scrolls inside its box: the buttons under the box stay in the window (#2224).+/// Measured against the panel's bottom once the agents on this machine have been looked for:+/// what that finds (and the status it reports) arrives in its own time and may change what is+/// around the panel, which is not what this checks.#[test]fn a_long_message_keeps_the_buttons_in_the_window() {let mut h = crate::scenario::Harness::new();h.call("ui.resize", json!({"width": 1600.0, "height": 1000.0}));h.call("ui.agent_chat", json!({"open": true}));h.frames(8);+ let began = std::time::Instant::now();+ while h.app.agent_chat.detecting.is_some() && began.elapsed() < std::time::Duration::from_secs(30) {+ h.frame();+ std::thread::sleep(std::time::Duration::from_millis(5));+ }+ h.frames(4);+ let bottom = |h: &crate::scenario::Harness| f64::from(h.app.agent_chat.panel_rect.map(|r| r.bottom()).expect("the panel is drawn"));let [_, rest] = h.widget("Send").expect("the Send button is drawn");- let box_before = h.app.agent_chat.panel_rect.map(|r| r.bottom());+ let rest = bottom(&h) - rest;h.app.agent_chat.input = "Please make the plate thicker and then add a fillet on every outside edge.\n".repeat(60);h.frames(8);let window = 1000.0;for name in ["Send", "Attach view"] {let [_, y] = h.widget(name).unwrap_or_else(|| panic!("{name} is drawn"));assert!(y < window, "{name} is at {y}, below the window's bottom at {window}");- // The box is pinned to the bottom and grows upwards: the buttons do not move.- assert!((y - rest).abs() < 1.0, "{name} moved from {rest} to {y}");+ // The box is pinned to the bottom and grows upwards: the buttons stay where they were+ // above the panel's bottom.+ let above = bottom(&h) - y;+ assert!((above - rest).abs() < 1.0, "{name} moved from {rest} to {above} above the panel's bottom");}- assert_eq!(h.app.agent_chat.panel_rect.map(|r| r.bottom()), box_before, "the panel keeps its size");}fn test_png(colour: [u8; 4], width: u32) -> Vec<u8> {