Merge origin/main; one test_window harness with wheel, panel_rect and click_at

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-10 01:55:55 -04:00
co-authored by Claude Opus 5.5
parent eaa76a467f
commit d6c9762a2c
-34
View File
@@ -1099,40 +1099,6 @@ pub(crate) mod test_window {
pub fn panel_rect(h: &Harness<'static, Window>, id: &str) -> egui::Rect {
egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new(id)).map(|s| s.outer_rect).unwrap()
}
}
/// The whole window in a headless test harness, at a chosen window size.
#[cfg(test)]
pub(crate) mod test_window {
use egui_kittest::Harness;
pub struct Window {
pub app: crate::DesignApp,
ready: bool,
}
/// The window at `size` with a new document open.
pub fn open(mut app: crate::DesignApp, size: egui::Vec2) -> Harness<'static, Window> {
if app.session.active().is_none() {
app.run("file.new", serde_json::json!({})).unwrap();
}
let mut h = Harness::builder().with_size(size).with_max_steps(1000).build_ui_state(
|ui, w: &mut Window| {
// The builder runs a frame before the texture size can be raised: skip it.
if !w.ready {
return;
}
let ctx = ui.ctx().clone();
w.app.logic(&ctx);
w.app.ui(ui);
},
Window { app, ready: false },
);
h.input_mut().max_texture_side = Some(8192);
h.state_mut().ready = true;
h.run_steps(6);
h
}
/// A primary click at `pos`, then a few frames.
pub fn click_at(h: &mut Harness<'static, Window>, pos: egui::Pos2) {