1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

Add ability to test recent / upcoming matches on schedule screen

This commit is contained in:
Dean Herbert 2023-08-31 18:05:18 +09:00
parent 7aa1505062
commit 4b68493084

View File

@ -12,6 +12,13 @@ namespace osu.Game.Tournament.Tests.Screens
{
public partial class TestSceneScheduleScreen : TournamentScreenTestScene
{
public override void SetUpSteps()
{
AddStep("clear matches", () => Ladder.Matches.Clear());
base.SetUpSteps();
}
[BackgroundDependencyLoader]
private void load()
{
@ -34,6 +41,36 @@ namespace osu.Game.Tournament.Tests.Screens
AddStep("Set null current match", () => Ladder.CurrentMatch.Value = null);
}
[Test]
public void TestUpcomingMatches()
{
AddStep("Add upcoming match", () =>
{
var tournamentMatch = CreateSampleMatch();
tournamentMatch.Date.Value = DateTimeOffset.UtcNow.AddMinutes(5);
tournamentMatch.Completed.Value = false;
Ladder.Matches.Add(tournamentMatch);
});
}
[Test]
public void TestRecentMatches()
{
AddStep("Add recent match", () =>
{
var tournamentMatch = CreateSampleMatch();
tournamentMatch.Date.Value = DateTimeOffset.UtcNow;
tournamentMatch.Completed.Value = true;
tournamentMatch.Team1Score.Value = tournamentMatch.PointsToWin;
tournamentMatch.Team2Score.Value = tournamentMatch.PointsToWin / 2;
Ladder.Matches.Add(tournamentMatch);
});
}
private void setMatchDate(TimeSpan relativeTime)
// Humanizer cannot handle negative timespans.
=> AddStep($"start time is {relativeTime}", () =>