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
|
|
|
|
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 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));
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|