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>
25 lines
554 B
C#
25 lines
554 B
C#
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);
|
|
}
|
|
}
|