Fix & clarify catcher tests

This commit is contained in:
ekrctb 2020-12-04 10:09:07 +09:00
parent 7e66714c2f
commit 3de46d0a3b

View File

@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Catch.Tests
} }
[Test] [Test]
public void TestCatcherStateFruit() public void TestFruitChangesCatcherState()
{ {
AddStep("miss fruit", () => attemptCatch(new Fruit { X = 100 })); AddStep("miss fruit", () => attemptCatch(new Fruit { X = 100 }));
checkState(CatcherAnimationState.Fail); checkState(CatcherAnimationState.Fail);
@ -82,7 +82,19 @@ namespace osu.Game.Rulesets.Catch.Tests
} }
[Test] [Test]
public void TestCatcherStateTinyDroplet() public void TestNormalFruitResetsHyperDashState()
{
AddStep("catch hyper fruit", () => attemptCatch(new Fruit
{
HyperDashTarget = new Fruit { X = 100 }
}));
checkHyperDash(true);
AddStep("catch normal fruit", () => attemptCatch(new Fruit()));
checkHyperDash(false);
}
[Test]
public void TestTinyDropletMissPreservesCatcherState()
{ {
AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit
{ {
@ -90,19 +102,21 @@ namespace osu.Game.Rulesets.Catch.Tests
})); }));
AddStep("catch tiny droplet", () => attemptCatch(new TinyDroplet())); AddStep("catch tiny droplet", () => attemptCatch(new TinyDroplet()));
AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { X = 100 })); AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { X = 100 }));
// catcher state and hyper dash state is preserved
checkState(CatcherAnimationState.Kiai); checkState(CatcherAnimationState.Kiai);
checkHyperDash(true); checkHyperDash(true);
} }
[Test] [Test]
public void TestCatcherStateBanana() public void TestBananaMissPreservesCatcherState()
{ {
AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit
{ {
HyperDashTarget = new Fruit { X = 100 } HyperDashTarget = new Fruit { X = 100 }
})); }));
AddStep("miss banana", () => attemptCatch(new Banana())); AddStep("miss banana", () => attemptCatch(new Banana { X = 100 }));
checkState(CatcherAnimationState.Idle); // catcher state is preserved but hyper dash state is reset
checkState(CatcherAnimationState.Kiai);
checkHyperDash(false); checkHyperDash(false);
} }
@ -135,18 +149,6 @@ namespace osu.Game.Rulesets.Catch.Tests
AddAssert("fruits are dropped", () => !catcher.CaughtObjects.Any() && droppedObjectContainer.Count == 10); AddAssert("fruits are dropped", () => !catcher.CaughtObjects.Any() && droppedObjectContainer.Count == 10);
} }
[Test]
public void TestHyperFruitHyperDash()
{
AddStep("catch hyper fruit", () => attemptCatch(new Fruit
{
HyperDashTarget = new Fruit { X = 100 }
}));
checkHyperDash(true);
AddStep("catch normal fruit", () => attemptCatch(new Fruit()));
checkHyperDash(false);
}
[TestCase(true)] [TestCase(true)]
[TestCase(false)] [TestCase(false)]
public void TestHitLighting(bool enabled) public void TestHitLighting(bool enabled)