From c11258a7e9075a6ca818178365446a3d4024108c Mon Sep 17 00:00:00 2001
From: ansel <79257300125@ya.ru>
Date: Sat, 8 Oct 2022 17:20:25 +0300
Subject: [PATCH] Tidy up test reloading

---
 .../Visual/Online/TestSceneCommentActions.cs  | 27 ++++++++++++-------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentActions.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentActions.cs
index a58873e457..51ae8efba7 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentActions.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentActions.cs
@@ -9,6 +9,7 @@ using osu.Framework.Allocation;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Testing;
+using osu.Game.Graphics.Containers;
 using osu.Game.Graphics.Sprites;
 using osu.Game.Online.API;
 using osu.Game.Online.API.Requests;
@@ -21,6 +22,8 @@ namespace osu.Game.Tests.Visual.Online
 {
     public class TestSceneCommentActions : OsuManualInputManagerTestScene
     {
+        private Container<Drawable> content = null!;
+        protected override Container<Drawable> Content => content;
         private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
 
         [Cached(typeof(IDialogOverlay))]
@@ -31,22 +34,26 @@ namespace osu.Game.Tests.Visual.Online
 
         private CommentsContainer commentsContainer = null!;
 
+        [BackgroundDependencyLoader]
+        private void load()
+        {
+            base.Content.AddRange(new Drawable[]
+            {
+                content = new OsuScrollContainer
+                {
+                    RelativeSizeAxes = Axes.Both
+                },
+                dialogOverlay
+            });
+        }
+
         [SetUpSteps]
         public void SetUp()
         {
             Schedule(() =>
             {
                 API.Login("test", "test");
-                if (dialogOverlay.Parent != null) Remove(dialogOverlay, false);
-                Children = new Container<Drawable>[]
-                {
-                    new BasicScrollContainer
-                    {
-                        RelativeSizeAxes = Axes.Both,
-                        Child = commentsContainer = new CommentsContainer()
-                    },
-                    dialogOverlay
-                };
+                Child = commentsContainer = new CommentsContainer();
             });
         }