46 lines
1.4 KiB
C#
46 lines
1.4 KiB
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);
|
|
}
|
|
|
|
[Fact]
|
|
public void CellEmptySprite_stamps_existing_and_future_cells()
|
|
{
|
|
var list = new UiItemList(); // ctor adds one default cell
|
|
Assert.Equal(0x060074CFu, list.GetItem(0)!.EmptySprite); // UiItemSlot default before set
|
|
|
|
list.CellEmptySprite = 0x06004D20u; // a pack-slot sprite
|
|
Assert.Equal(0x06004D20u, list.GetItem(0)!.EmptySprite); // existing cell re-stamped
|
|
|
|
list.AddItem(new UiItemSlot());
|
|
Assert.Equal(0x06004D20u, list.GetItem(1)!.EmptySprite); // new cell stamped
|
|
}
|
|
|
|
[Fact]
|
|
public void CellEmptySprite_zero_leaves_the_UiItemSlot_default()
|
|
{
|
|
var list = new UiItemList();
|
|
list.CellEmptySprite = 0u;
|
|
Assert.Equal(0x060074CFu, list.GetItem(0)!.EmptySprite); // unchanged default
|
|
}
|
|
}
|