2020-03-22 03:15:20 +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.
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
2021-03-18 01:39:48 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-03-22 03:15:20 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-03-18 01:39:48 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu;
|
2020-03-22 03:15:20 +08:00
|
|
|
|
using osu.Game.Screens.Edit.Components;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
2021-03-18 01:37:11 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual.Editing
|
2020-03-22 03:15:20 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestSceneEditorClock : EditorClockTestScene
|
|
|
|
|
{
|
|
|
|
|
public TestSceneEditorClock()
|
|
|
|
|
{
|
|
|
|
|
Add(new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new TimeInfoContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(200, 100)
|
|
|
|
|
},
|
|
|
|
|
new PlaybackControl
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(200, 100)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 01:39:48 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 03:15:20 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestStopAtTrackEnd()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Reset clock", () => Clock.Seek(0));
|
|
|
|
|
AddStep("Start clock", Clock.Start);
|
|
|
|
|
AddAssert("Clock running", () => Clock.IsRunning);
|
|
|
|
|
AddStep("Seek near end", () => Clock.Seek(Clock.TrackLength - 250));
|
|
|
|
|
AddUntilStep("Clock stops", () => !Clock.IsRunning);
|
|
|
|
|
AddAssert("Clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
|
|
|
|
|
AddStep("Start clock again", Clock.Start);
|
2020-03-25 15:02:20 +08:00
|
|
|
|
AddAssert("Clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
|
2020-03-22 03:15:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|