From 37dc878f3111617e45baa6e6dac55c42a709bf30 Mon Sep 17 00:00:00 2001 From: semmelrinde <124386289+semmelrinde@users.noreply.github.com> Date: Fri, 30 Oct 2026 08:58:15 +0000 Subject: [PATCH] Shell: test the interface scale raised in a narrow window, the crash #9271 fixed (#9315) Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/src/shell_tests.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/ui-egui/src/shell_tests.rs b/crates/ui-egui/src/shell_tests.rs index d93d17bd0..6a5b5064c 100644 --- a/crates/ui-egui/src/shell_tests.rs +++ b/crates/ui-egui/src/shell_tests.rs @@ -1211,3 +1211,21 @@ fn content_outside_a_shrunk_viewport_gives_way_to_the_viewport() { assert!(free.min.x.is_finite() && free.min.y.is_finite(), "{free:?}"); } } + +/// The interface scale raised after a click at the top of a narrow window (found by a UI fuzzer +/// and shrunk to these three steps): the content kept from the frame before lay outside the new +/// viewport, and the next frame's layout panicked clamping into it (`min = 264.0, max = +/// 165.28125`). +#[test] +fn a_larger_interface_scale_in_a_narrow_window_keeps_drawing() { + let mut h = Harness::new(); + for step in [ + json!({"call": "ui.resize", "params": {"width": 330.5693343218654, "height": 1445.8773151935186}}), + json!({"click": [206.1875, 17.0]}), + json!({"call": "ui.prefs", "params": {"ui_scale": 2.0}}), + ] { + h.step(&step).unwrap(); + } + h.frames(3); + assert!(h.app.viewport.rect.unwrap().is_positive()); +}