Skip to content

Commit

Permalink
Add ability to test recent / upcoming matches on schedule screen
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Aug 31, 2023
1 parent 7aa1505 commit 4b68493
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -34,6 +41,36 @@ public void TestNoCurrentMatch()
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}", () =>
Expand Down

0 comments on commit 4b68493

Please sign in to comment.