diff --git a/crates/ui-egui/src/addons/packaging.rs b/crates/ui-egui/src/addons/packaging.rs index 52df74f8cf..a6aa04dfc7 100644 --- a/crates/ui-egui/src/addons/packaging.rs +++ b/crates/ui-egui/src/addons/packaging.rs @@ -355,7 +355,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let kept = read_rows(app); let rows = &kept.rows; let source = Positional { rows, label: |row| role_label(&row.0) }; + // The four roles: the list is as tall as its rows, so the Fold Angle row, Check and Fold Preview show under them. let out = List::::new(tl!("Fold line roles").to_string()) + .natural_height(true) .select(SelectMode::None) .activate(ActivateOn::Click) .enabled(selected) diff --git a/crates/ui-egui/src/addons/packaging/tests.rs b/crates/ui-egui/src/addons/packaging/tests.rs index 086ac45e1a..26d9ac729b 100644 --- a/crates/ui-egui/src/addons/packaging/tests.rs +++ b/crates/ui-egui/src/addons/packaging/tests.rs @@ -229,7 +229,6 @@ fn canceling_a_fold_angle_edit_restores_the_angle_and_enter_is_one_undo_step() { let doc = panel.app().session.active().unwrap().doc.clone(); let angle = read_rows(&mut panel.app()).angle; let undo = undo_len(&panel.app()); - // The role list fills the panel's height, so the field below it takes the focus as a screen reader gives it. panel.focus("Fold Angle"); panel.key(Key::A, Modifiers::COMMAND); panel.type_text(text); @@ -250,3 +249,22 @@ fn canceling_a_fold_angle_edit_restores_the_angle_and_enter_is_one_undo_step() { } } } + +/// At the size the panel floats at, the role list is as tall as its rows, and the Fold Angle row, +/// Check and Fold Preview under it lie inside the panel. +#[test] +fn the_fold_angle_row_check_and_fold_preview_show_under_the_roles() { + let (mut app, a, _) = app(); + app.run(SET_ROLE, json!({"role": "crease", "ids": [a]})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + let mut panel = Panel::new(app, show); + let room = crate::panel_docking::floating_size(ID); + panel.room(room).frame(); + panel.frame(); + let (list, last) = (panel.rect("Fold line roles"), panel.rect("Perforation Line")); + assert!(list.bottom() <= last.bottom() + 8.0, "the list ends at its last role: {list:?} {last:?}"); + for name in ["Fold Angle", "Check", "Fold Preview"] { + let rect = panel.rect(name); + assert!(rect.top() >= list.bottom() && rect.bottom() <= room.y, "{name} at {rect:?} lies under the list {list:?}, inside {room:?}"); + } +} diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index e89c22b337..f132c35145 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -926,12 +926,14 @@ fn tab_strip_buttons_are_named_by_their_labels() { assert!(ids.is_empty(), "buttons named by a command id: {ids:?}"); } -/// A panel the Window menu floats opens tall enough for its content: every control of Asset Export, -/// and every Image Trace control down to the top of its Advanced section, lies between the body's -/// top and bottom, none scrolled or clipped away. +/// A panel the Window menu floats opens tall enough for its content: every control of Asset Export +/// and Fold Lines, and every Image Trace control down to the top of its Advanced section, lies +/// between the body's top and bottom, none scrolled or clipped away. #[test] fn window_menu_floats_open_tall_enough_for_their_content() { - for (panel, title, until) in [("assetExport", "Asset Export", None), ("imageTrace", "Image Trace", Some("Advanced"))] { + for (panel, title, until) in + [("assetExport", "Asset Export", None), ("foldLines", "Fold Lines", None), ("imageTrace", "Image Trace", Some("Advanced"))] + { let mut h = Harness::new(); h.app.run("window.panel", json!({"panel": panel})).unwrap(); assert!(floating_window(&h.layout(), panel).is_some(), "{panel} floats");