mirror of https://github.com/ppy/osu
Add test coverage against frequency ramp increasing between fail animation and fail screen
This commit is contained in:
parent
91a21152df
commit
5be22916bb
|
@ -31,12 +31,18 @@ protected override void AddCheckSteps()
|
|||
{
|
||||
AddUntilStep("wait for fail", () => Player.HasFailed);
|
||||
AddUntilStep("wait for fail overlay", () => ((FailPlayer)Player).FailOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
// The pause screen and fail animation both ramp frequency.
|
||||
// This tests to ensure that it doesn't reset during that handoff.
|
||||
AddAssert("frequency only ever decreased", () => !((FailPlayer)Player).FrequencyIncreased);
|
||||
}
|
||||
|
||||
private class FailPlayer : TestPlayer
|
||||
{
|
||||
public new FailOverlay FailOverlay => base.FailOverlay;
|
||||
|
||||
public bool FrequencyIncreased { get; private set; }
|
||||
|
||||
public FailPlayer()
|
||||
: base(false, false)
|
||||
{
|
||||
|
@ -47,6 +53,19 @@ protected override void LoadComplete()
|
|||
base.LoadComplete();
|
||||
HealthProcessor.FailConditions += (_, __) => true;
|
||||
}
|
||||
|
||||
private double lastFrequency = double.MaxValue;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
double freq = Beatmap.Value.Track.AggregateFrequency.Value;
|
||||
|
||||
FrequencyIncreased |= freq > lastFrequency;
|
||||
|
||||
lastFrequency = freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue