mirror of
https://github.com/ppy/osu
synced 2025-02-22 21:47:12 +00:00
Generalize legacy skin player test.
This commit is contained in:
parent
4f17e3520e
commit
604619ba47
@ -2,39 +2,13 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneCatchPlayerLegacySkin : PlayerTestScene
|
||||
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
|
||||
{
|
||||
private ISkinSource legacySkinSource;
|
||||
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuGameBase game)
|
||||
{
|
||||
var legacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), audio);
|
||||
legacySkinSource = new SkinProvidingContainer(legacySkin);
|
||||
}
|
||||
|
||||
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
||||
|
||||
public class SkinProvidingPlayer : TestPlayer
|
||||
{
|
||||
[Cached(typeof(ISkinSource))]
|
||||
private readonly ISkinSource skinSource;
|
||||
|
||||
public SkinProvidingPlayer(ISkinSource skinSource)
|
||||
{
|
||||
this.skinSource = skinSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs
Normal file
38
osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs
Normal file
@ -0,0 +1,38 @@
|
||||
// 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.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public abstract class LegacySkinPlayerTestScene : PlayerTestScene
|
||||
{
|
||||
private ISkinSource legacySkinSource;
|
||||
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuGameBase game)
|
||||
{
|
||||
var legacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), audio);
|
||||
legacySkinSource = new SkinProvidingContainer(legacySkin);
|
||||
}
|
||||
|
||||
public class SkinProvidingPlayer : TestPlayer
|
||||
{
|
||||
[Cached(typeof(ISkinSource))]
|
||||
private readonly ISkinSource skinSource;
|
||||
|
||||
public SkinProvidingPlayer(ISkinSource skinSource)
|
||||
{
|
||||
this.skinSource = skinSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user