1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:07:26 +08:00
osu-lazer/osu.Game/Tests/Visual/TestCaseBreakOverlay.cs

61 lines
1.9 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing;
2017-09-21 03:33:07 +08:00
using osu.Game.Screens.Play.BreaksOverlay;
using System.Collections.Generic;
2017-09-19 22:37:34 +08:00
namespace osu.Game.Tests.Visual
{
internal class TestCaseBreakOverlay : OsuTestCase
{
public override string Description => @"Tests breaks behavior";
private readonly BreakOverlay breakOverlay;
public TestCaseBreakOverlay()
{
Clock = new FramedClock();
2017-09-20 20:58:28 +08:00
Child = breakOverlay = new BreakOverlay(true);
AddStep("Add 2s break", () => startBreak(2000));
AddStep("Add 5s break", () => startBreak(5000));
2017-09-21 03:33:07 +08:00
AddStep("Add 10s break", () => startBreak(10000));
AddStep("Add 15s break", () => startBreak(15000));
AddStep("Add 2 breaks (2s each)", startMultipleBreaks);
}
private void startBreak(double duration)
{
breakOverlay.Breaks = new List<BreakPeriod>
{
new BreakPeriod
{
StartTime = Clock.CurrentTime,
EndTime = Clock.CurrentTime + duration,
}
};
}
private void startMultipleBreaks()
{
double currentTime = Clock.CurrentTime;
breakOverlay.Breaks = new List<BreakPeriod>
{
new BreakPeriod
{
StartTime = currentTime,
EndTime = currentTime + 2000,
},
new BreakPeriod
{
StartTime = currentTime + 4000,
EndTime = currentTime + 6000,
}
};
}
}
}