Measure unused space on both sides of the bottom toolbar

This commit is contained in:
Codex committed 2026-11-30 18:48:37 +01:00
1 parent ce7f8548b7
commit 91eb17547e
1 file changed
+3 -1
+3 -1
View File
@@ -1568,6 +1568,8 @@ fn a_horizontal_toolbar_fits_its_controls_above_or_below_the_page() {
for edge in ["Top", "Bottom"] {
let (mut h, c) = harness();
ok(&mut h, &c, "ui.set", json!({"key":"mode","value":"edit"}));
h.run_steps(3);
let dock_bottom = h.get_by_role_and_label(Role::Canvas, "Pages").rect().bottom();
ok(&mut h, &c, "ui.dock.apply", json!({"action":{"Move":{"panel":"toolbar","anchor":"document","placement":{"Edge":edge}}}}));
for width in [1400.0, 820.0, 1400.0] {
h.set_size(egui::vec2(width, 900.0));
@@ -1575,7 +1577,7 @@ fn a_horizontal_toolbar_fits_its_controls_above_or_below_the_page() {
let rail = h.get_by_role_and_label(Role::Toolbar, "Toolbar").rect();
let pages = h.get_by_role_and_label(Role::Canvas, "Pages").rect();
let grip = h.get_by_role_and_label(Role::Button, "Toolbar").rect();
let gap = if edge == "Top" { pages.top() - rail.bottom() } else { grip.top() - pages.bottom() };
let gap = if edge == "Top" { pages.top() - rail.bottom() } else { grip.top() - pages.bottom() + dock_bottom - rail.bottom() };
let sizes = craft::ui::docking::DockSizes::of(&h.ctx);
// The dock also enforces its theme's minimum panel body and strip height.
let floor = (sizes.least_pane + sizes.strip - grip.height() - rail.height()).max(0.0);