1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00
osu-lazer/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneObjectPlacement.cs

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

65 lines
2.6 KiB
C#
Raw Normal View History

2023-01-12 02:20:56 +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;
using osu.Framework.Allocation;
2023-01-12 02:20:56 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mania.Objects.Drawables;
2023-01-12 02:20:56 +08:00
using osu.Game.Tests.Visual;
using osuTK.Input;
namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public partial class TestSceneObjectPlacement : EditorTestScene
2023-01-12 02:20:56 +08:00
{
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
[Resolved]
private OsuConfigManager config { get; set; } = null!;
2023-01-12 02:20:56 +08:00
[Test]
public void TestPlacement()
{
AddStep("Seek to 0", () => EditorClock.Seek(0));
AddStep("Select note", () => InputManager.Key(Key.Number2));
AddStep("Hover negative span", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<Container>().First(x => x.Name == "Icons").Children[0]);
});
AddStep("Click", () => InputManager.Click(MouseButton.Left));
AddAssert("No notes placed", () => EditorBeatmap.HitObjects.All(x => x.StartTime >= 0));
}
[Test]
public void TestSeekOnNotePlacement()
{
AddStep("Seek to 1935", () => EditorClock.Seek(1935));
2023-02-19 17:17:33 +08:00
AddStep("Change seek setting to true", () => config.SetValue(OsuSetting.EditorSeekToHitObject, true));
seekSetup();
AddUntilStep("Wait for seeking to end", () => !EditorClock.IsSeeking);
2023-02-19 17:17:33 +08:00
AddAssert("Seeked to object", () => EditorClock.CurrentTimeAccurate == 2287.1875);
}
[Test]
public void TestNoSeekOnNotePlacement()
{
AddStep("Seek to 1935", () => EditorClock.Seek(1935));
2023-02-19 17:17:33 +08:00
AddStep("Change seek setting to false", () => config.SetValue(OsuSetting.EditorSeekToHitObject, false));
seekSetup();
AddAssert("Not seeking", () => !EditorClock.IsSeeking);
AddAssert("Not seeked to object", () => EditorClock.CurrentTime == 1935);
}
private void seekSetup()
{
AddStep("Seek to 1935", () => EditorClock.Seek(1935));
AddStep("Select note", () => InputManager.Key(Key.Number2));
AddStep("Place note", () => InputManager.MoveMouseTo(this.ChildrenOfType<DrawableHoldNoteHead>().First(x => x.HitObject.StartTime == 2170)));
AddStep("Click", () => InputManager.Click(MouseButton.Left));
}
2023-01-12 02:20:56 +08:00
}
}