2021-04-21 04:00:46 +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
|
|
|
|
|
2021-04-21 04:00:46 +00:00
|
|
|
using NUnit.Framework;
|
2022-10-05 10:14:31 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-04-21 04:00:46 +00:00
|
|
|
using osu.Framework.Graphics;
|
2021-09-16 13:41:35 +00:00
|
|
|
using osu.Framework.Input.Events;
|
2021-04-21 04:00:46 +00:00
|
|
|
using osu.Framework.Timing;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2022-10-05 10:14:31 +00:00
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
2021-04-21 04:00:46 +00:00
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
{
|
|
|
|
public partial class TestSceneDrawableManiaHitObject : OsuTestScene
|
|
|
|
{
|
|
|
|
private readonly ManualClock clock = new ManualClock();
|
|
|
|
|
|
|
|
private Column column;
|
|
|
|
|
2022-10-05 10:14:31 +00:00
|
|
|
[Cached]
|
|
|
|
private readonly StageDefinition stage = new StageDefinition(1);
|
|
|
|
|
2021-04-21 04:00:46 +00:00
|
|
|
[SetUp]
|
|
|
|
public void SetUp() => Schedule(() =>
|
|
|
|
{
|
|
|
|
Child = new ScrollingTestContainer(ScrollingDirection.Down)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
TimeRange = 2000,
|
|
|
|
Clock = new FramedClock(clock),
|
2022-10-04 09:24:49 +00:00
|
|
|
Child = column = new Column(0, false)
|
2021-04-21 04:00:46 +00:00
|
|
|
{
|
|
|
|
Action = { Value = ManiaAction.Key1 },
|
|
|
|
Height = 0.85f,
|
2022-10-05 11:02:02 +00:00
|
|
|
AccentColour = { Value = Color4.Gray },
|
2021-04-21 04:00:46 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestHoldNoteHeadVisibility()
|
|
|
|
{
|
|
|
|
DrawableHoldNote note = null;
|
|
|
|
AddStep("Add hold note", () =>
|
|
|
|
{
|
|
|
|
var h = new HoldNote
|
|
|
|
{
|
|
|
|
StartTime = 0,
|
|
|
|
Duration = 1000
|
|
|
|
};
|
|
|
|
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
|
|
|
column.Add(note = new DrawableHoldNote(h));
|
|
|
|
});
|
|
|
|
AddStep("Hold key", () =>
|
|
|
|
{
|
|
|
|
clock.CurrentTime = 0;
|
2021-09-16 13:41:35 +00:00
|
|
|
note.OnPressed(new KeyBindingPressEvent<ManiaAction>(GetContainingInputManager().CurrentState, ManiaAction.Key1));
|
2021-04-21 04:00:46 +00:00
|
|
|
});
|
|
|
|
AddStep("progress time", () => clock.CurrentTime = 500);
|
|
|
|
AddAssert("head is visible", () => note.Head.Alpha == 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|