1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

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.
This commit is contained in:
Bartłomiej Dach 2020-02-22 00:56:17 +01:00
parent e21db7dbbe
commit f248c0a98e

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Overlays.Direct; using osu.Game.Overlays.Direct;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -14,7 +15,7 @@ using osuTK;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
{ {
public class TestSceneDirectPanel : OsuTestScene public class TestSceneDirectPanel : OsuTestScene, IPreviewTrackOwner
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
@ -23,6 +24,13 @@ namespace osu.Game.Tests.Visual.Online
typeof(IconPill) typeof(IconPill)
}; };
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IPreviewTrackOwner>(this);
return dependencies;
}
private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo
{ {
OnlineBeatmapSetID = 123, OnlineBeatmapSetID = 123,