Skip to content

Commit

Permalink
Fix test not really applying a combo colour
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Aug 19, 2024
1 parent f7fc75d commit 8fd296d
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8fd296d

Please sign in to comment.