From 986f4fa407caf9e5906444b2fa4ec0cca5a4b68b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 5 Dec 2023 21:55:25 +0300 Subject: [PATCH] Add test scenarios for same-frame judgements --- .../Gameplay/TestSceneArgonHealthDisplay.cs | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneArgonHealthDisplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneArgonHealthDisplay.cs index 3197de42d0..d863755a85 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneArgonHealthDisplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneArgonHealthDisplay.cs @@ -83,13 +83,18 @@ public void TestHealthDisplayIncrementing() AddRepeatStep(@"increase hp with flash", delegate { healthProcessor.Health.Value += 0.1f; - healthProcessor.ApplyResult(new JudgementResult(new HitCircle(), new OsuJudgement()) - { - Type = HitResult.Perfect - }); + applyPerfectHit(); }, 3); } + private void applyPerfectHit() + { + healthProcessor.ApplyResult(new JudgementResult(new HitCircle(), new OsuJudgement()) + { + Type = HitResult.Perfect + }); + } + [Test] public void TestLateMissAfterConsequentMisses() { @@ -124,6 +129,29 @@ public void TestMissAlmostExactlyAfterLastMissAnimation() }); } + [Test] + public void TestMissThenHitAtSameUpdateFrame() + { + AddUntilStep("wait for health", () => healthDisplay.Current.Value == 1); + AddStep("set half health", () => healthProcessor.Health.Value = 0.5f); + AddStep("apply miss and hit", () => + { + applyMiss(); + applyMiss(); + applyPerfectHit(); + applyPerfectHit(); + }); + AddWaitStep("wait", 3); + AddStep("apply miss and cancel with hit", () => + { + applyMiss(); + applyPerfectHit(); + applyPerfectHit(); + applyPerfectHit(); + applyPerfectHit(); + }); + } + private void applyMiss() { healthProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Miss });