Merge branch 'master' into legacy-skin-resource-improvements

This commit is contained in:
Dean Herbert
2021-05-31 19:35:54 +09:00
14 changed files with 185 additions and 63 deletions

View File

@ -3,6 +3,8 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Skinning;
@ -11,6 +13,8 @@ namespace osu.Game.Tests.Visual
[TestFixture]
public abstract class LegacySkinPlayerTestScene : PlayerTestScene
{
protected LegacySkin LegacySkin { get; private set; }
private ISkinSource legacySkinSource;
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
@ -18,8 +22,31 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader]
private void load(SkinManager skins)
{
var legacySkin = new DefaultLegacySkin(skins);
legacySkinSource = new SkinProvidingContainer(legacySkin);
LegacySkin = new DefaultLegacySkin(skins);
legacySkinSource = new SkinProvidingContainer(LegacySkin);
}
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
addResetTargetsStep();
}
[TearDownSteps]
public override void TearDownSteps()
{
addResetTargetsStep();
base.TearDownSteps();
}
private void addResetTargetsStep()
{
AddStep("reset targets", () => this.ChildrenOfType<SkinnableTargetContainer>().ForEach(t =>
{
LegacySkin.ResetDrawableTarget(t);
t.Reload();
}));
}
public class SkinProvidingPlayer : TestPlayer