mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 07:27:45 +08:00
Add tests for time display
This commit is contained in:
parent
c30b700b3a
commit
899942611f
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Tournament.Components;
|
||||
@ -16,5 +18,23 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
|
||||
Add(new ScheduleScreen());
|
||||
}
|
||||
|
||||
[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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user