mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 12:03:21 +08:00
Fix LegacySkinPlayerTestScene
overriden by default beatmap skin
This commit is contained in:
parent
50a3775a22
commit
265a89e5cc
@ -1,11 +1,17 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
@ -16,6 +22,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
||||||
|
|
||||||
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||||
|
=> new LegacySkinWorkingBeatmap(beatmap, storyboard, Clock, Audio);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, SkinManager skins)
|
private void load(OsuGameBase game, SkinManager skins)
|
||||||
{
|
{
|
||||||
@ -23,6 +32,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
legacySkinSource = new SkinProvidingContainer(legacySkin);
|
legacySkinSource = new SkinProvidingContainer(legacySkin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetUpSteps()
|
||||||
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
|
||||||
|
// check presence of a random legacy HUD component to ensure this is using legacy skin.
|
||||||
|
AddAssert("using legacy skin", () => this.ChildrenOfType<LegacyScoreCounter>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
public class SkinProvidingPlayer : TestPlayer
|
public class SkinProvidingPlayer : TestPlayer
|
||||||
{
|
{
|
||||||
[Cached(typeof(ISkinSource))]
|
[Cached(typeof(ISkinSource))]
|
||||||
@ -33,5 +50,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
this.skinSource = skinSource;
|
this.skinSource = skinSource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class LegacySkinWorkingBeatmap : ClockBackedTestWorkingBeatmap
|
||||||
|
{
|
||||||
|
public LegacySkinWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock frameBasedClock, AudioManager audio)
|
||||||
|
: base(beatmap, storyboard, frameBasedClock, audio)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ISkin GetSkin() => new LegacyBeatmapSkin(BeatmapInfo, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user