1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:12:56 +08:00

Tidy up test logic

This commit is contained in:
Dean Herbert 2022-09-07 16:43:48 +09:00
parent 3003fc1061
commit cb1bb99208

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
@ -20,7 +18,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
public class TestSceneHitEventTimingDistributionGraph : OsuTestScene
{
private HitEventTimingDistributionGraph graph;
private HitEventTimingDistributionGraph graph = null!;
private static readonly HitObject placeholder_object = new HitCircle();
@ -63,7 +61,12 @@ namespace osu.Game.Tests.Visual.Ranking
createTest(CreateDistributedHitEvents(0, 50).Select(h =>
{
double offset = Math.Abs(h.TimeOffset);
var result = offset > 36 ? HitResult.Miss : offset > 32 ? HitResult.Meh : offset > 24 ? HitResult.Ok : offset > 16 ? HitResult.Good : offset > 8 ? HitResult.Great : HitResult.Perfect;
HitResult result = offset > 36 ? HitResult.Miss
: offset > 32 ? HitResult.Meh
: offset > 24 ? HitResult.Ok
: offset > 16 ? HitResult.Good
: offset > 8 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
}).ToList());
}
@ -74,13 +77,24 @@ namespace osu.Game.Tests.Visual.Ranking
var wide = CreateDistributedHitEvents(0, 50).Select(h =>
{
double offset = Math.Abs(h.TimeOffset);
var result = offset > 36 ? HitResult.Miss : offset > 32 ? HitResult.Meh : offset > 24 ? HitResult.Ok : offset > 16 ? HitResult.Good : offset > 8 ? HitResult.Great : HitResult.Perfect;
HitResult result = offset > 36 ? HitResult.Miss
: offset > 32 ? HitResult.Meh
: offset > 24 ? HitResult.Ok
: offset > 16 ? HitResult.Good
: offset > 8 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
});
var narrow = CreateDistributedHitEvents(0, 50).Select(h =>
{
double offset = Math.Abs(h.TimeOffset);
var result = offset > 25 ? HitResult.Miss : offset > 20 ? HitResult.Meh : offset > 15 ? HitResult.Ok : offset > 10 ? HitResult.Good : offset > 5 ? HitResult.Great : HitResult.Perfect;
HitResult result = offset > 25 ? HitResult.Miss
: offset > 20 ? HitResult.Meh
: offset > 15 ? HitResult.Ok
: offset > 10 ? HitResult.Good
: offset > 5 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
});
createTest(wide.Concat(narrow).ToList());