refactor(ui): own retained controller lifetimes

This commit is contained in:
Erik 2026-07-10 23:35:26 +02:00
parent 921c388e2c
commit 5d9e98c118
21 changed files with 373 additions and 35 deletions

View file

@ -98,6 +98,28 @@ public class ToolbarControllerTests
Assert.Equal(0x5002u, slots[Row1[2]].Cell.ItemId); // rebound on ItemAdded
}
[Fact]
public void Dispose_UnsubscribesDeferredRebind_AndIsIdempotent()
{
var (layout, slots, _) = FakeToolbar();
var repo = new ClientObjectTable();
var shortcuts = new List<PlayerDescriptionParser.ShortcutEntry>
{ new(Index: 2, ObjectGuid: 0x5002u, SpellId: 0, Layer: 0) };
var controller = ToolbarController.Bind(layout, repo, () => shortcuts,
iconIds: (_,_,_,_,_) => 0x88u, useItem: _ => { });
controller.Dispose();
controller.Dispose();
repo.AddOrUpdate(new ClientObject
{
ObjectId = 0x5002u,
WeenieClassId = 1u,
IconId = 0x06005678u,
});
Assert.Equal(0u, slots[Row1[2]].Cell.ItemId);
}
[Fact]
public void Click_emitsUseForBoundItem()
{