From 89a2a2857a4e0dd5dae4fb643039b4ee88f9d6c9 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 20 Jun 2026 18:37:33 +0200 Subject: [PATCH] =?UTF-8?q?test(ui):=20D.2b=20=E2=80=94=20cover=20ResizeRe?= =?UTF-8?q?ct=20maxH=20clamp=20(Bottom=20+=20Top=20edges)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spec §6 test 3 — the maxH clamp is the load-bearing path for the toolbar collapse; the implementer updated the existing ResizeRect tests' signatures but didn't add the clamp-verification cases. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../AcDream.App.Tests/UI/UiRootInputTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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() {