osu/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.6 KiB
C#
Raw Normal View History

2020-11-06 14:56:02 +00: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.
2022-06-17 07:37:17 +00:00
#nullable disable
2020-11-06 14:56:02 +00:00
using NUnit.Framework;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public partial class TestSceneSpinnerApplication : OsuTestScene
{
[Test]
2020-11-14 19:12:46 +00:00
public void TestApplyNewSpinner()
2020-11-06 14:56:02 +00:00
{
DrawableSpinner dho = null;
AddStep("create spinner", () => Child = dho = new DrawableSpinner(prepareObject(new Spinner
{
Position = new Vector2(256, 192),
IndexInCurrentCombo = 0,
2020-11-14 19:12:46 +00:00
Duration = 500,
2020-11-06 14:56:02 +00:00
}))
{
Clock = new FramedClock(new StopwatchClock())
});
2020-11-14 19:12:46 +00:00
AddStep("rotate some", () => dho.RotationTracker.AddRotation(180));
AddAssert("rotation is set", () => dho.Result.TotalRotation == 180);
2020-11-14 19:12:46 +00:00
2020-11-06 14:56:02 +00:00
AddStep("apply new spinner", () => dho.Apply(prepareObject(new Spinner
{
Position = new Vector2(256, 192),
ComboIndex = 1,
Duration = 1000,
2021-04-21 05:32:37 +00:00
})));
2020-11-14 19:12:46 +00:00
AddAssert("rotation is reset", () => dho.Result.TotalRotation == 0);
2020-11-06 14:56:02 +00:00
}
private Spinner prepareObject(Spinner circle)
{
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return circle;
}
}
}