From 8fd296d6c3e4ae6523217f437e8ad3d3fbdcc189 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Aug 2024 17:45:57 +0900 Subject: [PATCH] Fix test not really applying a combo colour --- .../TestSceneComboCounter.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs index ac2294c7414d..0f97263afad3 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs @@ -25,7 +25,7 @@ public partial class TestSceneComboCounter : CatchSkinnableTestScene [Cached(typeof(ScoreProcessor))] private ScoreProcessor scoreProcessor; - private Color4 judgedObjectColour = Color4.White; + private Color4? judgedObjectColour; public TestSceneComboCounter() { @@ -61,23 +61,27 @@ public void SetUp() => Schedule(() => [Test] public void TestCatchComboCounter() { - AddRepeatStep("perform hit", () => performJudgement(HitResult.Great), 20); - AddStep("perform miss", () => performJudgement(HitResult.Miss)); - - AddStep("randomize judged object colour", () => + AddRepeatStep("perform hit", () => { - judgedObjectColour = new Color4( - RNG.NextSingle(1f), - RNG.NextSingle(1f), - RNG.NextSingle(1f), - 1f - ); - }); + if (judgedObjectColour == null || RNG.NextDouble() > 0.8) + { + judgedObjectColour = new Color4( + RNG.NextSingle(1f), + RNG.NextSingle(1f), + RNG.NextSingle(1f), + 1f + ); + } + + performJudgement(HitResult.Great); + }, 20); + + AddStep("perform miss", () => performJudgement(HitResult.Miss)); } private void performJudgement(HitResult type, Judgement? judgement = null) { - var judgedObject = new DrawableFruit(new ColourfulFruit(judgedObjectColour)); + var judgedObject = new DrawableFruit(new ColourfulFruit(judgedObjectColour!.Value)); var result = new JudgementResult(judgedObject.HitObject, judgement ?? new Judgement()) { Type = type }; scoreProcessor.ApplyResult(result);