diff --git a/tests/AcDream.App.Tests/UI/UiRootInputTests.cs b/tests/AcDream.App.Tests/UI/UiRootInputTests.cs index 89123682..9f326919 100644 --- a/tests/AcDream.App.Tests/UI/UiRootInputTests.cs +++ b/tests/AcDream.App.Tests/UI/UiRootInputTests.cs @@ -173,6 +173,27 @@ public class UiRootInputTests Assert.Equal(70f, x); } + [Fact] + public void ResizeRect_Bottom_ClampsToMaxH() + { + // dy=1000 on a 50-tall window with maxH=128 → height clamps to 128, origin unchanged. + var (_, y, _, h) = UiRoot.ResizeRect(10, 20, 100, 50, + ResizeEdges.Bottom, dx: 0, dy: 1000, minW: 40, minH: 40, maxW: float.MaxValue, maxH: 128f); + Assert.Equal(128f, h); + Assert.Equal(20f, y); + } + + [Fact] + public void ResizeRect_Top_ClampsToMaxH() + { + // Drag the top edge UP by 1000 on a 50-tall window with maxH=128 → height clamps to 128, + // origin shifts so the bottom edge (70) stays put → y = 20 + 50 - 128. + var (_, y, _, h) = UiRoot.ResizeRect(10, 20, 100, 50, + ResizeEdges.Top, dx: 0, dy: -1000, minW: 40, minH: 40, maxW: float.MaxValue, maxH: 128f); + Assert.Equal(128f, h); + Assert.Equal(20f + 50f - 128f, y); + } + [Fact] public void HitEdges_DetectsCornerAndInteriorNone() {