diff --git a/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs b/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs index b61e9da270..946fd52a63 100644 --- a/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs +++ b/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs @@ -48,6 +48,32 @@ public sealed class ListContainerTest : RobustUnitTest Assert.That(children[1].Position.Y, Is.EqualTo(13)); // Item height + separation } + [Test] + public void TestCreatePopulateAndEmpty() + { + const int x = 50; + const int y = 10; + var root = new Control { MinSize = (x, y) }; + var listContainer = new ListContainer { SeparationOverride = 3 }; + root.AddChild(listContainer); + listContainer.GenerateItem += (_, button) => { + button.AddChild(new Control { MinSize = (10, 10) }); + }; + + var list = new List(); + listContainer.PopulateList(list); + root.Arrange(new UIBox2(0, 0, x, y)); + + list.Add(new(0)); + list.Add(new (1)); + listContainer.PopulateList(list); + root.Arrange(new UIBox2(0, 0, x, y)); + + list.Clear(); + listContainer.PopulateList(list); + root.Arrange(new UIBox2(0, 0, x, y)); + } + [Test] public void TestOnlyVisibleItemsAreAdded() {