feat(D.2b): UiNineSlicePanel — 8-piece retail window frame + geometry test
Implements the retail floating-window bevel as a UiPanel subclass using RetailChromeSprites: 4 tiled edges + 4 stretched corners + tiled center fill, matching the 8-piece border layout confirmed by the D.2b Step-0 prove-out. Resolver delegate keeps GL out of unit tests. Geometry verified by ComputeFrameRects_PlacesCornersEdgesAndCenter (1/1 pass). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8e91805206
commit
0bf790c8bf
2 changed files with 112 additions and 0 deletions
27
tests/AcDream.App.Tests/UI/UiNineSlicePanelTests.cs
Normal file
27
tests/AcDream.App.Tests/UI/UiNineSlicePanelTests.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using AcDream.App.UI;
|
||||
|
||||
namespace AcDream.App.Tests.UI;
|
||||
|
||||
public class UiNineSlicePanelTests
|
||||
{
|
||||
[Fact]
|
||||
public void ComputeFrameRects_PlacesCornersEdgesAndCenter()
|
||||
{
|
||||
var r = UiNineSlicePanel.ComputeFrameRects(100, 80, 5);
|
||||
|
||||
// 5x5 corners at the four corners
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(0, 0, 5, 5), r.TL);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(95, 0, 5, 5), r.TR);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(0, 75, 5, 5), r.BL);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(95, 75, 5, 5), r.BR);
|
||||
|
||||
// edges span the interior (100-2*5 = 90 wide, 80-2*5 = 70 tall)
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(5, 0, 90, 5), r.Top);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(5, 75, 90, 5), r.Bottom);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(0, 5, 5, 70), r.Left);
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(95, 5, 5, 70), r.Right);
|
||||
|
||||
// center fills the interior
|
||||
Assert.Equal(new UiNineSlicePanel.Rect(5, 5, 90, 70), r.Center);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue