1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

Fix broken tests

This commit is contained in:
Poyo 2023-11-12 11:13:38 -08:00
parent 064857c40b
commit d123ba5bce
3 changed files with 21 additions and 19 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.NonVisual.Ranking
public void TestDistributedHits()
{
var events = Enumerable.Range(-5, 11)
.Select(t => new HitEvent(t - 5, HitResult.Great, new HitObject(), null, null));
.Select(t => new HitEvent(t - 5, 1.0, HitResult.Great, new HitObject(), null, null));
var unstableRate = new UnstableRate(events);
@ -33,9 +33,9 @@ namespace osu.Game.Tests.NonVisual.Ranking
{
var events = new[]
{
new HitEvent(-100, HitResult.Miss, new HitObject(), null, null),
new HitEvent(0, HitResult.Great, new HitObject(), null, null),
new HitEvent(200, HitResult.Meh, new HitObject { HitWindows = HitWindows.Empty }, null, null),
new HitEvent(-100, 1.0, HitResult.Miss, new HitObject(), null, null),
new HitEvent(0, 1.0, HitResult.Great, new HitObject(), null, null),
new HitEvent(200, 1.0, HitResult.Meh, new HitObject { HitWindows = HitWindows.Empty }, null, null),
};
var unstableRate = new UnstableRate(events);

View File

@ -56,6 +56,7 @@ namespace osu.Game.Tests.Visual.Gameplay
scoreProcessor.RevertResult(
new JudgementResult(new HitCircle { HitWindows = hitWindows }, new Judgement())
{
GameplayRate = 1.0,
TimeOffset = 25,
Type = HitResult.Perfect,
});
@ -92,7 +93,7 @@ namespace osu.Game.Tests.Visual.Gameplay
});
}
private void applyJudgement(double offsetMs, bool alt)
private void applyJudgement(double offsetMs, bool alt, double gameplayRate = 1.0)
{
double placement = offsetMs;
@ -105,6 +106,7 @@ namespace osu.Game.Tests.Visual.Gameplay
scoreProcessor.ApplyResult(new JudgementResult(new HitCircle { HitWindows = hitWindows }, new Judgement())
{
TimeOffset = placement,
GameplayRate = gameplayRate,
Type = HitResult.Perfect,
});
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test]
public void TestAroundCentre()
{
createTest(Enumerable.Range(-150, 300).Select(i => new HitEvent(i / 50f, HitResult.Perfect, placeholder_object, placeholder_object, null)).ToList());
createTest(Enumerable.Range(-150, 300).Select(i => new HitEvent(i / 50f, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null)).ToList());
}
[Test]
@ -57,12 +57,12 @@ namespace osu.Game.Tests.Visual.Ranking
{
createTest(new List<HitEvent>
{
new HitEvent(-7, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(-6, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(-5, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(5, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(6, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(7, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(-7, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(-6, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(-5, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(5, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(6, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
new HitEvent(7, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null),
});
}
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.Ranking
: offset > 16 ? HitResult.Good
: offset > 8 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
return new HitEvent(h.TimeOffset, 1.0, result, placeholder_object, placeholder_object, null);
}).ToList());
}
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Ranking
: offset > 8 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
return new HitEvent(h.TimeOffset, 1.0, result, placeholder_object, placeholder_object, null);
});
var narrow = CreateDistributedHitEvents(0, 50).Select(h =>
{
@ -106,7 +106,7 @@ namespace osu.Game.Tests.Visual.Ranking
: offset > 10 ? HitResult.Good
: offset > 5 ? HitResult.Great
: HitResult.Perfect;
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
return new HitEvent(h.TimeOffset, 1.0, result, placeholder_object, placeholder_object, null);
});
createTest(wide.Concat(narrow).ToList());
}
@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test]
public void TestZeroTimeOffset()
{
createTest(Enumerable.Range(0, 100).Select(_ => new HitEvent(0, HitResult.Perfect, placeholder_object, placeholder_object, null)).ToList());
createTest(Enumerable.Range(0, 100).Select(_ => new HitEvent(0, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null)).ToList());
}
[Test]
@ -129,9 +129,9 @@ namespace osu.Game.Tests.Visual.Ranking
createTest(Enumerable.Range(0, 100).Select(i =>
{
if (i % 2 == 0)
return new HitEvent(0, HitResult.Perfect, placeholder_object, placeholder_object, null);
return new HitEvent(0, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null);
return new HitEvent(30, HitResult.Miss, placeholder_object, placeholder_object, null);
return new HitEvent(30, 1.0, HitResult.Miss, placeholder_object, placeholder_object, null);
}).ToList());
}
@ -162,7 +162,7 @@ namespace osu.Game.Tests.Visual.Ranking
int count = (int)(Math.Pow(range - Math.Abs(i - range), 2)) / 10;
for (int j = 0; j < count; j++)
hitEvents.Add(new HitEvent(centre + i - range, HitResult.Perfect, placeholder_object, placeholder_object, null));
hitEvents.Add(new HitEvent(centre + i - range, 1.0, HitResult.Perfect, placeholder_object, placeholder_object, null));
}
return hitEvents;