mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 05:27:17 +09:00
Add test coverage of resuming after pause not skipping forward in time
This commit is contained in:
parent
eb3601b7ff
commit
ad5ef52922
@ -90,6 +90,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("player not playing", () => !Player.LocalUserPlaying.Value);
|
AddAssert("player not playing", () => !Player.LocalUserPlaying.Value);
|
||||||
|
|
||||||
resumeAndConfirm();
|
resumeAndConfirm();
|
||||||
|
|
||||||
|
AddAssert("Resumed without seeking forward", () => Player.LastResumeTime, () => Is.LessThanOrEqualTo(Player.LastPauseTime));
|
||||||
|
|
||||||
AddUntilStep("player playing", () => Player.LocalUserPlaying.Value);
|
AddUntilStep("player playing", () => Player.LocalUserPlaying.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +381,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("pause overlay " + (isShown ? "shown" : "hidden"), () => Player.PauseOverlayVisible == isShown);
|
AddAssert("pause overlay " + (isShown ? "shown" : "hidden"), () => Player.PauseOverlayVisible == isShown);
|
||||||
|
|
||||||
private void confirmClockRunning(bool isRunning) =>
|
private void confirmClockRunning(bool isRunning) =>
|
||||||
AddUntilStep("clock " + (isRunning ? "running" : "stopped"), () => Player.GameplayClockContainer.IsRunning == isRunning);
|
AddUntilStep("clock " + (isRunning ? "running" : "stopped"), () =>
|
||||||
|
{
|
||||||
|
bool completed = Player.GameplayClockContainer.IsRunning == isRunning;
|
||||||
|
|
||||||
|
if (completed)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return completed;
|
||||||
|
});
|
||||||
|
|
||||||
protected override bool AllowFail => true;
|
protected override bool AllowFail => true;
|
||||||
|
|
||||||
@ -386,6 +398,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
protected class PausePlayer : TestPlayer
|
protected class PausePlayer : TestPlayer
|
||||||
{
|
{
|
||||||
|
public double LastPauseTime { get; private set; }
|
||||||
|
public double LastResumeTime { get; private set; }
|
||||||
|
|
||||||
public bool FailOverlayVisible => FailOverlay.State.Value == Visibility.Visible;
|
public bool FailOverlayVisible => FailOverlay.State.Value == Visibility.Visible;
|
||||||
|
|
||||||
public bool PauseOverlayVisible => PauseOverlay.State.Value == Visibility.Visible;
|
public bool PauseOverlayVisible => PauseOverlay.State.Value == Visibility.Visible;
|
||||||
@ -399,6 +414,23 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
base.OnEntering(e);
|
base.OnEntering(e);
|
||||||
GameplayClockContainer.Stop();
|
GameplayClockContainer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool? isRunning;
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
if (GameplayClockContainer.IsRunning != isRunning)
|
||||||
|
{
|
||||||
|
isRunning = GameplayClockContainer.IsRunning;
|
||||||
|
|
||||||
|
if (isRunning.Value)
|
||||||
|
LastResumeTime = GameplayClockContainer.CurrentTime;
|
||||||
|
else
|
||||||
|
LastPauseTime = GameplayClockContainer.CurrentTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user