1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 07:12:58 +08:00
osu-lazer/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.5 KiB
C#
Raw Normal View History

2019-03-04 12:24:19 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-11-11 09:13:17 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2021-01-24 00:01:47 +08:00
using System;
using NUnit.Framework;
2018-11-11 09:13:17 +08:00
using osu.Framework.Allocation;
2020-03-07 12:26:54 +08:00
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
2018-11-11 09:13:17 +08:00
using osu.Game.Tournament.Screens.Schedule;
2019-06-18 14:28:36 +08:00
namespace osu.Game.Tournament.Tests.Screens
2018-11-11 09:13:17 +08:00
{
2019-07-30 06:23:25 +08:00
public partial class TestSceneScheduleScreen : TournamentTestScene
2018-11-11 09:13:17 +08:00
{
[BackgroundDependencyLoader]
private void load()
{
2020-03-07 12:26:54 +08:00
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
2018-11-11 09:13:17 +08:00
Add(new ScheduleScreen());
}
2021-01-24 00:01:47 +08:00
[Test]
public void TestCurrentMatchTime()
{
setMatchDate(TimeSpan.FromDays(-1));
setMatchDate(TimeSpan.FromSeconds(5));
setMatchDate(TimeSpan.FromMinutes(4));
setMatchDate(TimeSpan.FromHours(3));
}
[Test]
public void TestNoCurrentMatch()
{
AddStep("Set null current match", () => Ladder.CurrentMatch.Value = null);
}
2021-01-24 00:01:47 +08:00
private void setMatchDate(TimeSpan relativeTime)
// Humanizer cannot handle negative timespans.
=> AddStep($"start time is {relativeTime}", () =>
{
var match = CreateSampleMatch();
match.Date.Value = DateTimeOffset.Now + relativeTime;
Ladder.CurrentMatch.Value = match;
});
2018-11-11 09:13:17 +08:00
}
}