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
|
|
|
{
|
2023-07-24 17:22:32 +08:00
|
|
|
public partial class TestSceneScheduleScreen : TournamentScreenTestScene
|
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));
|
|
|
|
}
|
|
|
|
|
2021-07-16 23:21:58 +08:00
|
|
|
[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
|
|
|
}
|
|
|
|
}
|