Tests: screen-mode drags and popups start clear of the task bar

In Full Screen Mode with Menu Bar and Full Screen Mode the canvas is
about 390 pt wide, so the Contextual Task Bar under the selected
rectangle now wraps onto a second row and covers the canvas's center.
The middle-button pan, hand, zoom and context menu tests pressed there
and reached the bar instead of the canvas. They now press low on the
canvas, at a point the helper checks is clear of the bar.
This commit is contained in:
dotCooCoo
2026-11-13 15:31:04 -08:00
parent 3a10022dcf
commit 9484b116ab
+10 -2
View File
@@ -80,6 +80,14 @@ fn in_screen_mode(ctx: &egui::Context, mode: u8) -> VectorcraftApp {
app
}
/// A point on the empty canvas, low enough to miss the Contextual Task Bar under the selection
/// (on a narrow canvas its actions wrap onto more rows and can reach the canvas's center).
fn open_canvas_point(app: &VectorcraftApp, ctx: &egui::Context) -> egui::Pos2 {
let p = app.canvas_rect.unwrap().lerp_inside(egui::vec2(0.5, 0.85));
assert!(crate::canvas::task_bar_rect(ctx).is_none_or(|bar| !bar.expand(40.0).contains(p)), "the task bar covers {p:?}");
p
}
fn begin_tools_move(app: &mut VectorcraftApp, ctx: &egui::Context) -> (Option<[f32; 2]>, egui::Pos2) {
app.run("window.panel.float", json!({"panel": "tools", "x": 120, "y": 140})).unwrap();
frame(app, ctx, vec![]);
@@ -241,7 +249,7 @@ fn navigation_drag_keeps_screen_mode(kind: &str) {
_ => panic!("unknown navigation drag"),
};
frame(&mut app, &ctx, vec![]);
let start = app.canvas_rect.unwrap().center();
let start = open_canvas_point(&app, &ctx);
let end = start + egui::vec2(35.0, 20.0);
let pointer = |pos, pressed| egui::Event::PointerButton { pos, button, pressed, modifiers: Default::default() };
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(start), pointer(start, true)]);
@@ -551,7 +559,7 @@ fn held_escape_that_cancels_a_dialog_or_leaves_presentation_skips_a_command_boun
fn a_popup_takes_escape_before_full_screen_exits() {
let ctx = egui::Context::default();
let mut app = in_screen_mode(&ctx, 2);
let pos = app.canvas_rect.unwrap().center();
let pos = open_canvas_point(&app, &ctx);
let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Secondary, pressed, modifiers: Default::default() };
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(pos), button(true)]);
frame(&mut app, &ctx, vec![button(false)]);