Behavioral leaf widget for the toolbar item cell. Draws the empty-slot sprite (0x060074CF) when unbound; draws the pre-composited icon texture when a weenie is bound via SetItem(). ConsumesDatChildren=true prevents the LayoutImporter from double-building the dat sub-elements. SpriteResolve is configurable so paperdoll equip slots can swap in per-slot silhouettes later. No Clicked/OnEvent — that wiring comes in Task 8 (ToolbarController). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
717 B
C#
31 lines
717 B
C#
using AcDream.App.UI;
|
|
|
|
namespace AcDream.App.Tests.UI;
|
|
|
|
public class UiItemSlotTests
|
|
{
|
|
[Fact]
|
|
public void IsLeafWidget()
|
|
=> Assert.True(new UiItemSlot().ConsumesDatChildren);
|
|
|
|
[Fact]
|
|
public void DefaultEmptySprite_isToolbarBorder()
|
|
=> Assert.Equal(0x060074CFu, new UiItemSlot().EmptySprite);
|
|
|
|
[Fact]
|
|
public void Empty_whenNoItem()
|
|
{
|
|
var s = new UiItemSlot();
|
|
Assert.Equal(0u, s.ItemId);
|
|
Assert.Equal(0u, s.IconTexture);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetItem_setsIdAndTexture()
|
|
{
|
|
var s = new UiItemSlot();
|
|
s.SetItem(0x5001u, 0x99u);
|
|
Assert.Equal(0x5001u, s.ItemId);
|
|
Assert.Equal(0x99u, s.IconTexture);
|
|
}
|
|
}
|