mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Make sure egui can handle zero-sized screen rect
This would previously hit a debug assert Fixes https://github.com/emilk/egui/issues/395
This commit is contained in:
@@ -139,3 +139,22 @@ fn test_egui_e2e() {
|
||||
assert!(!clipped_meshes.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_egui_zero_window_size() {
|
||||
let mut demo_windows = crate::DemoWindows::default();
|
||||
let mut ctx = egui::CtxRef::default();
|
||||
let raw_input = egui::RawInput {
|
||||
screen_rect: Some(egui::Rect::from_min_max(egui::Pos2::ZERO, egui::Pos2::ZERO)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
const NUM_FRAMES: usize = 5;
|
||||
for _ in 0..NUM_FRAMES {
|
||||
ctx.begin_frame(raw_input.clone());
|
||||
demo_windows.ui(&ctx);
|
||||
let (_output, shapes) = ctx.end_frame();
|
||||
let clipped_meshes = ctx.tessellate(shapes);
|
||||
assert!(clipped_meshes.is_empty(), "There should be nothing to show");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user