From f248c0a98eed52098eb364ed66c3ba3a37cd2b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 22 Feb 2020 00:56:17 +0100 Subject: [PATCH 1/2] Fix regressed direct panel test scene Due to unnoticed past changes TestSceneDirectPanel has regressed in that clicking the preview track button would crash due to an unregistered IPreviewTrackOwner dependency. Make the test scene itself implement that empty interface and cache itself as IPreviewTrackOwner so that preview tracks lower down can resolve the dependency. As the test is purely visual and has no assertions, and the important logic in that area (preview track playing logic) is already well-covered enough elsewhere, no further changes were made. --- osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 731cb62518..ccd428fe68 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Overlays.Direct; using osu.Game.Rulesets; @@ -14,7 +15,7 @@ using osuTK; namespace osu.Game.Tests.Visual.Online { - public class TestSceneDirectPanel : OsuTestScene + public class TestSceneDirectPanel : OsuTestScene, IPreviewTrackOwner { public override IReadOnlyList RequiredTypes => new[] { @@ -23,6 +24,13 @@ namespace osu.Game.Tests.Visual.Online typeof(IconPill) }; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(this); + return dependencies; + } + private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo { OnlineBeatmapSetID = 123, From a512226036b43be8bd7a8d04f8630848d2aca2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 22 Feb 2020 13:47:42 +0100 Subject: [PATCH 2/2] Use attribute instead of CreateChildDependencies --- osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index ccd428fe68..cb08cded37 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -15,6 +15,7 @@ using osuTK; namespace osu.Game.Tests.Visual.Online { + [Cached(typeof(IPreviewTrackOwner))] public class TestSceneDirectPanel : OsuTestScene, IPreviewTrackOwner { public override IReadOnlyList RequiredTypes => new[] @@ -24,13 +25,6 @@ namespace osu.Game.Tests.Visual.Online typeof(IconPill) }; - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - dependencies.CacheAs(this); - return dependencies; - } - private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo { OnlineBeatmapSetID = 123,