1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 13:12:56 +08:00
osu-lazer/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSpunOut.cs

60 lines
1.7 KiB
C#
Raw Normal View History

2020-02-08 10:16:04 +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 System.Linq;
using NUnit.Framework;
2020-02-11 04:39:45 +08:00
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mods;
2020-02-08 10:16:04 +08:00
using osu.Game.Rulesets.Osu.Mods;
2020-02-11 04:39:45 +08:00
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
2020-02-08 10:16:04 +08:00
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
2020-02-11 04:39:45 +08:00
public class TestSceneSpinnerSpunOut : OsuTestScene
2020-02-08 10:16:04 +08:00
{
[SetUp]
public void SetUp() => Schedule(() =>
{
2020-02-08 10:49:49 +08:00
SelectedMods.Value = new[] { new OsuModSpunOut() };
2020-02-08 10:16:04 +08:00
});
2020-02-11 04:39:45 +08:00
[Test]
public void TestSpunOut()
{
DrawableSpinner spinner = null;
AddStep("create spinner", () => spinner = createSpinner());
AddUntilStep("wait for end", () => Time.Current > spinner.LifetimeEnd);
AddAssert("spinner is completed", () => spinner.Progress >= 1);
}
private DrawableSpinner createSpinner()
{
var spinner = new Spinner
{
StartTime = Time.Current + 500,
EndTime = Time.Current + 2500
};
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
var drawableSpinner = new DrawableSpinner(spinner)
{
Anchor = Anchor.Centre
};
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(new[] { drawableSpinner });
Add(drawableSpinner);
return drawableSpinner;
}
2020-02-08 10:16:04 +08:00
}
}