From ba14935cb5dccca234ec46cee55bde4afd7f5b65 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 23 Nov 2026 04:38:35 +0700 Subject: [PATCH] Tests a-m: a link opens in the app frame after the dialogs' pump, so the hand-off test draws one; the drag tests place a drop on a document not shown yet in the canvas area the shown ones have --- crates/ui-egui/src/tests/automation.rs | 5 ++--- crates/ui-egui/src/tests/document_drag.rs | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/tests/automation.rs b/crates/ui-egui/src/tests/automation.rs index 291114551b..888caa8bd4 100644 --- a/crates/ui-egui/src/tests/automation.rs +++ b/crates/ui-egui/src/tests/automation.rs @@ -2049,11 +2049,10 @@ fn automation_cannot_hand_files_or_urls_to_other_apps() { }; let (tx, rx) = std::sync::mpsc::channel(); let mut app = VectorcraftApp::new(Session::new(), services).with_control(rx); - // The URLs a frame asks the window to open. + // The URLs a frame of the app asks the window to open: a link opens in the pass after the dialogs' pump. let ctx = crate::testing::ui_context(); let urls = |app: &mut VectorcraftApp| -> Vec { - let mut out = ctx.run_ui(egui::RawInput::default(), |ui| app.tick(ui.ctx())); - out.textures_delta.clear(); + let out = crate::testing::app_frame(app, &ctx, egui::RawInput::default()); let opens = out.platform_output.commands.iter().filter_map(|c| if let egui::OutputCommand::OpenUrl(u) = c { Some(u.url.clone()) } else { None }); opens.collect() diff --git a/crates/ui-egui/src/tests/document_drag.rs b/crates/ui-egui/src/tests/document_drag.rs index acd24e3aa0..8e65e157fc 100644 --- a/crates/ui-egui/src/tests/document_drag.rs +++ b/crates/ui-egui/src/tests/document_drag.rs @@ -53,7 +53,12 @@ fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64, events: Vec Pos2 { - app.canvas_view().unwrap().to_screen(Point::new(x, y)) + // A document not shown yet takes the canvas area the shown ones were laid out in. + let view = app.canvas_view().or_else(|| { + let rect = app.views.iter().map(|v| v.rect).find(|r| r.width() > 0.0 && r.height() > 0.0)?; + Some(app.view()?.canvas(app.ui_scaling(), rect)) + }); + view.unwrap().to_screen(Point::new(x, y)) } /// Build a primary-pointer event without keyboard modifiers.