mirror of
https://github.com/ppy/osu
synced 2024-12-25 00:02:48 +00:00
Add test coverage
This commit is contained in:
parent
102842bcf1
commit
243c8aa585
@ -1,8 +1,16 @@
|
|||||||
// 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.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
{
|
{
|
||||||
@ -10,5 +18,23 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
|
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
|
||||||
{
|
{
|
||||||
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("HUD components broken, remove when fixed.")]
|
||||||
|
public void TestLegacyHUDComboCounterHidden([Values] bool withModifiedSkin)
|
||||||
|
{
|
||||||
|
if (withModifiedSkin)
|
||||||
|
{
|
||||||
|
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
|
||||||
|
AddStep("update target", () => Player.ChildrenOfType<SkinnableTargetContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
|
||||||
|
AddStep("exit player", () => Player.Exit());
|
||||||
|
CreateTest(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAssert("legacy HUD combo counter hidden", () =>
|
||||||
|
{
|
||||||
|
return Player.ChildrenOfType<LegacyComboCounter>().All(counter => !counter.IsPresent || !counter.IsAlive);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.IO;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -12,6 +16,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public abstract class LegacySkinPlayerTestScene : PlayerTestScene
|
public abstract class LegacySkinPlayerTestScene : PlayerTestScene
|
||||||
{
|
{
|
||||||
|
protected LegacySkin LegacySkin { get; private set; }
|
||||||
|
|
||||||
private ISkinSource legacySkinSource;
|
private ISkinSource legacySkinSource;
|
||||||
|
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
|
||||||
@ -19,8 +25,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, SkinManager skins)
|
private void load(OsuGameBase game, SkinManager skins)
|
||||||
{
|
{
|
||||||
var legacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), skins);
|
LegacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), skins);
|
||||||
legacySkinSource = new SkinProvidingContainer(legacySkin);
|
legacySkinSource = new SkinProvidingContainer(LegacySkin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SkinProvidingPlayer : TestPlayer
|
public class SkinProvidingPlayer : TestPlayer
|
||||||
|
Loading…
Reference in New Issue
Block a user