feat(D.5.1): UiItemList widget + factory branch for class 0x10000031
Ports retail UIElement_ItemList (class 0x10000031) as a behavioral-leaf container that owns its UiItemSlot children procedurally. Single-cell default covers every toolbar slot; N-cell grid is deferred to the inventory phase. OnDraw syncs the cell rect to the list's Width/Height each frame so the cell is sized and hit-testable from the first rendered frame, even though the factory sets rect AFTER construction. Factory: adds `0x10000031u => new UiItemList(resolve)` arm before the fallback, so all 18 toolbar itemlist slots route to UiItemList instead of UiDatElement. Tests: 4 new (IsLeafWidget, StartsWithOneCell, Cell_returnsFirstSlot, Create_buildsUiItemList_forItemListClassId). All 4 pass; full suite green (415 pass / 2 skip in App.Tests; 0 fail total). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
28d5837309
commit
9c8db0d577
4 changed files with 97 additions and 0 deletions
|
|
@ -126,6 +126,16 @@ public class DatWidgetFactoryTests
|
|||
Assert.IsType<UiMenu>(e);
|
||||
}
|
||||
|
||||
// ── Test 7: Type 0x10000031 → UiItemList ────────────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void Create_buildsUiItemList_forItemListClassId()
|
||||
{
|
||||
var info = new AcDream.App.UI.Layout.ElementInfo { Id = 0x100001A7u, Type = 0x10000031u, Width = 32, Height = 32 };
|
||||
var w = AcDream.App.UI.Layout.DatWidgetFactory.Create(info, _ => (0u, 0, 0), null);
|
||||
Assert.IsType<AcDream.App.UI.UiItemList>(w);
|
||||
}
|
||||
|
||||
// ── Test 6: Meter slice extraction (the important one) ───────────────────
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
25
tests/AcDream.App.Tests/UI/UiItemListTests.cs
Normal file
25
tests/AcDream.App.Tests/UI/UiItemListTests.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using AcDream.App.UI;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.App.Tests.UI;
|
||||
|
||||
public class UiItemListTests
|
||||
{
|
||||
[Fact]
|
||||
public void IsLeafWidget() => Assert.True(new UiItemList().ConsumesDatChildren);
|
||||
|
||||
[Fact]
|
||||
public void StartsWithOneCell_forSingleCellSlot()
|
||||
{
|
||||
var list = new UiItemList();
|
||||
Assert.Equal(1, list.GetNumUIItems());
|
||||
Assert.NotNull(list.GetItem(0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cell_returnsTheFirstSlot()
|
||||
{
|
||||
var list = new UiItemList();
|
||||
Assert.Same(list.GetItem(0), list.Cell);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue