1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 23:00:04 -04:00

Panel: never overflow available width, nor max_width (#8198)

* Closes https://github.com/emilk/egui/issues/8055
* Closes https://github.com/emilk/egui/pull/8056

This changes the behavior of `Panel` to NEVER overflow
`Panel::max_size`, nor the available space in the parent UI.

If you do overflow it, the content will be silently clipped.
This commit is contained in:
Emil Ernerfeldt
2026-05-26 10:54:38 +02:00
committed by GitHub
parent fc1b2a99fd
commit 0ce2b3699b
4 changed files with 171 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
use egui::containers::menu::{MenuBar, MenuConfig, SubMenuButton};
use egui::{PopupCloseBehavior, Ui, include_image};
use egui_kittest::{Harness, SnapshotResults};
use egui_kittest::Harness;
use kittest::Queryable as _;
struct TestMenu {
@@ -160,11 +160,12 @@ fn clicking_submenu_button_should_never_close_menu() {
assert!(harness.query_by_label("Button in Submenu B").is_none());
}
#[cfg(feature = "snapshot")]
#[test]
fn menu_snapshots() {
let mut harness = TestMenu::new(MenuConfig::new()).into_harness();
let mut results = SnapshotResults::new();
let mut results = egui_kittest::SnapshotResults::new();
harness.get_by_label("Menu A").hover();
harness.run();