feat(D.5.1): UiItemSlot widget (UIElement_UIItem cell port)
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>
This commit is contained in:
parent
e9a5248972
commit
1270596f30
2 changed files with 85 additions and 0 deletions
31
tests/AcDream.App.Tests/UI/UiItemSlotTests.cs
Normal file
31
tests/AcDream.App.Tests/UI/UiItemSlotTests.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue