mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 15:21:17 -05:00
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
This commit is contained in:
@@ -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<String> {
|
||||
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()
|
||||
|
||||
@@ -53,7 +53,12 @@ fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64, events: Vec<E
|
||||
|
||||
/// The screen point of document point `x`, `y` in the active view.
|
||||
fn at(app: &VectorcraftApp, x: f64, y: f64) -> 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.
|
||||
|
||||
Reference in New Issue
Block a user