2019-01-24 08:43:03 +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.
|
2018-10-25 09:48:11 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2019-10-01 10:33:08 +00:00
|
|
|
using NUnit.Framework;
|
2018-10-25 09:48:11 +00:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-11-07 07:08:56 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
2019-10-01 10:33:08 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
2018-10-25 09:48:11 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
using osu.Game.Tests.Visual;
|
2018-11-20 07:51:59 +00:00
|
|
|
using osuTK;
|
2018-10-25 09:48:11 +00:00
|
|
|
|
2020-09-25 09:48:04 +00:00
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Editor
|
2018-10-25 09:48:11 +00:00
|
|
|
{
|
2019-05-14 19:37:25 +00:00
|
|
|
public partial class TestSceneHitCircleSelectionBlueprint : SelectionBlueprintTestScene
|
2018-10-25 09:48:11 +00:00
|
|
|
{
|
2019-10-01 10:33:08 +00:00
|
|
|
private HitCircle hitCircle;
|
|
|
|
private DrawableHitCircle drawableObject;
|
|
|
|
private TestBlueprint blueprint;
|
2018-10-25 09:48:11 +00:00
|
|
|
|
2019-10-01 10:33:08 +00:00
|
|
|
[SetUp]
|
|
|
|
public void Setup() => Schedule(() =>
|
2018-10-25 09:48:11 +00:00
|
|
|
{
|
2019-10-01 10:33:08 +00:00
|
|
|
Clear();
|
|
|
|
|
|
|
|
hitCircle = new HitCircle { Position = new Vector2(256, 192) };
|
2018-10-25 09:48:11 +00:00
|
|
|
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
|
|
|
|
|
|
|
Add(drawableObject = new DrawableHitCircle(hitCircle));
|
2021-05-13 10:53:32 +00:00
|
|
|
AddBlueprint(blueprint = new TestBlueprint(hitCircle), drawableObject);
|
2019-10-01 10:33:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestInitialState()
|
|
|
|
{
|
|
|
|
AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestMoveHitObject()
|
|
|
|
{
|
|
|
|
AddStep("move hitobject", () => hitCircle.Position = new Vector2(300, 225));
|
|
|
|
AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestMoveAfterApplyingDefaults()
|
|
|
|
{
|
|
|
|
AddStep("apply defaults", () => hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }));
|
|
|
|
AddStep("move hitobject", () => hitCircle.Position = new Vector2(300, 225));
|
|
|
|
AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
|
2018-10-25 09:48:11 +00:00
|
|
|
}
|
|
|
|
|
2019-10-21 06:03:49 +00:00
|
|
|
[Test]
|
|
|
|
public void TestStackedHitObject()
|
|
|
|
{
|
|
|
|
AddStep("set stacking", () => hitCircle.StackHeight = 5);
|
|
|
|
AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.StackedPosition);
|
|
|
|
}
|
|
|
|
|
2019-10-01 10:33:08 +00:00
|
|
|
private partial class TestBlueprint : HitCircleSelectionBlueprint
|
|
|
|
{
|
|
|
|
public new HitCirclePiece CirclePiece => base.CirclePiece;
|
|
|
|
|
2021-05-13 10:53:32 +00:00
|
|
|
public TestBlueprint(HitCircle circle)
|
|
|
|
: base(circle)
|
2019-10-01 10:33:08 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2018-10-25 09:48:11 +00:00
|
|
|
}
|
|
|
|
}
|