diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs index b8e400aa60..ca102963cb 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs @@ -21,7 +21,6 @@ namespace osu.Game.Tests.Visual private DependencyContainer dependencies; private readonly TestChatLineContainer textContainer; - private readonly ChatLine[] testSprites; protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent); @@ -38,21 +37,25 @@ namespace osu.Game.Tests.Visual Direction = FillDirection.Vertical, }); - testSprites = new[] - { - new ChatLine(new DummyMessage("Test!")), - new ChatLine(new DummyMessage("osu.ppy.sh!")), - new ChatLine(new DummyMessage("http://lookatmy.horse/")), - new ChatLine(new DummyMessage("https://osu.ppy.sh!")), - new ChatLine(new DummyMessage("00:12:345 (1,2) - Test?")), - new ChatLine(new DummyMessage("Wiki link for tasty [[Performance Points]]")), - new ChatLine(new DummyMessage("(osu forums)[https://osu.ppy.sh/forum] (old link format)")), - new ChatLine(new DummyMessage("[https://osu.ppy.sh/home New site] (new link format)")), - new ChatLine(new DummyMessage("long message to test word wrap: use https://encrypted.google.com instead of https://google.com or even worse, [http://google.com Unencrypted google]")), - new ChatLine(new DummyMessage("is now listening to [https://osu.ppy.sh/s/93523 IMAGE -MATERIAL- ]", true)), - new ChatLine(new DummyMessage("is now playing [https://osu.ppy.sh/b/252238 IMAGE -MATERIAL- ]", true)), - new ChatLine(new DummyMessage("#lobby or #osu would be blue (and work) in the ChatDisplay test (when a proper ChatOverlay is present).")), - }; + testAddLinks(); + } + + private void testAddLinks() + { + int msgCounter = 0; + void addMessage(string text, bool isAction = false) => AddStep($"Add message #{++msgCounter}", () => textContainer.Add(new ChatLine(new DummyMessage(text, isAction)))); + + addMessage("Test!"); + addMessage("osu.ppy.sh!"); + addMessage("https://osu.ppy.sh!"); + addMessage("00:12:345 (1,2) - Test?"); + addMessage("Wiki link for tasty [[Performance Points]]"); + addMessage("(osu forums)[https://osu.ppy.sh/forum] (old link format)"); + addMessage("[https://osu.ppy.sh/home New site] (new link format)"); + addMessage("[https://osu.ppy.sh/home This is only a link to the new osu webpage but this is supposed to test word wrap.]"); + addMessage("is now listening to [https://osu.ppy.sh/s/93523 IMAGE -MATERIAL- ]", true); + addMessage("is now playing [https://osu.ppy.sh/b/252238 IMAGE -MATERIAL- ]", true); + addMessage("#lobby or #osu would be blue (and work) in the ChatDisplay test (when a proper ChatOverlay is present)."); } [BackgroundDependencyLoader] @@ -60,8 +63,6 @@ namespace osu.Game.Tests.Visual { dependencies.Cache(chat); dependencies.Cache(beatmapSetOverlay); - - textContainer.AddRange(testSprites); } private class DummyMessage : Message