Add hyper-dash fruit colouring test cases

This commit is contained in:
Salman Ahmed 2020-03-26 05:40:38 +03:00
parent d995f3e1cc
commit 29274b004c

View File

@ -28,6 +28,77 @@ namespace osu.Game.Rulesets.Catch.Tests
{
public class TestSceneHyperDashColouring : OsuTestScene
{
[TestCase(false)]
[TestCase(true)]
public void TestHyperDashFruitColour(bool legacyFruit)
{
DrawableFruit drawableFruit = null;
AddStep("setup fruit", () =>
{
var fruit = new Fruit { IndexInBeatmap = legacyFruit ? 0 : 1, HyperDashTarget = new Banana() };
fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Child = setupSkinHierarchy(() =>
drawableFruit = new DrawableFruit(fruit)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, false, false);
});
AddAssert("fruit colour default-hyperdash", () => checkFruitHyperDashColour(drawableFruit, Catcher.DefaultHyperDashColour, legacyFruit));
}
[TestCase(false, true)]
[TestCase(false, false)]
[TestCase(true, true)]
[TestCase(true, false)]
public void TestCustomHyperDashFruitColour(bool legacyFruit, bool customCatcherHyperDashColour)
{
DrawableFruit drawableFruit = null;
AddStep("setup fruit", () =>
{
var fruit = new Fruit { IndexInBeatmap = legacyFruit ? 0 : 1, HyperDashTarget = new Banana() };
fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Child = setupSkinHierarchy(() =>
drawableFruit = new DrawableFruit(fruit)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, customCatcherHyperDashColour, true);
});
AddAssert("fruit colour custom-hyperdash", () => checkFruitHyperDashColour(drawableFruit, TestLegacySkin.CustomHyperDashFruitColour, legacyFruit));
}
[TestCase(false)]
[TestCase(true)]
public void TestCustomHyperDashFruitColourFallback(bool legacyFruit)
{
DrawableFruit drawableFruit = null;
AddStep("setup fruit", () =>
{
var fruit = new Fruit { IndexInBeatmap = legacyFruit ? 0 : 1, HyperDashTarget = new Banana() };
fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Child = setupSkinHierarchy(() =>
drawableFruit = new DrawableFruit(fruit)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, true, false);
});
AddAssert("fruit colour catcher-custom-hyperdash", () => checkFruitHyperDashColour(drawableFruit, TestLegacySkin.CustomHyperDashColour, legacyFruit));
}
private Drawable setupSkinHierarchy(Func<Drawable> getChild, bool customHyperDashCatcherColour = false, bool customHyperDashFruitColour = false, bool customHyperDashAfterColour = false)
{
var testSkinProvider = new SkinProvidingContainer(new TestLegacySkin(customHyperDashCatcherColour, customHyperDashFruitColour, customHyperDashAfterColour));