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-11-12 10:41:06 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-04-23 03:05:34 +00:00
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
|
|
using osu.Framework.Testing;
|
2018-11-12 10:41:06 +00:00
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2020-04-23 03:05:34 +00:00
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2018-11-12 10:41:06 +00:00
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-04-23 03:05:34 +00:00
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
using osuTK.Input;
|
2018-11-12 10:41:06 +00:00
|
|
|
|
2020-09-25 09:48:04 +00:00
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
2018-11-12 10:41:06 +00:00
|
|
|
{
|
2019-05-14 19:37:25 +00:00
|
|
|
public partial class TestSceneNotePlacementBlueprint : ManiaPlacementBlueprintTestScene
|
2018-11-12 10:41:06 +00:00
|
|
|
{
|
2020-04-23 03:05:34 +00:00
|
|
|
[SetUp]
|
|
|
|
public void Setup() => Schedule(() =>
|
|
|
|
{
|
|
|
|
this.ChildrenOfType<HitObjectContainer>().ForEach(c => c.Clear());
|
|
|
|
|
|
|
|
ResetPlacement();
|
|
|
|
|
|
|
|
((ScrollingTestContainer)HitObjectContainer).Direction = ScrollingDirection.Down;
|
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestPlaceBeforeCurrentTimeDownwards()
|
|
|
|
{
|
2021-04-28 11:38:44 +00:00
|
|
|
AddStep("move mouse before current time", () =>
|
|
|
|
{
|
|
|
|
var column = this.ChildrenOfType<Column>().Single();
|
|
|
|
InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(-100));
|
|
|
|
});
|
2020-04-23 03:05:34 +00:00
|
|
|
|
|
|
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
|
|
|
|
|
|
|
AddAssert("note start time < 0", () => getNote().StartTime < 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestPlaceAfterCurrentTimeDownwards()
|
|
|
|
{
|
2021-04-28 11:38:44 +00:00
|
|
|
AddStep("move mouse after current time", () =>
|
|
|
|
{
|
|
|
|
var column = this.ChildrenOfType<Column>().Single();
|
|
|
|
InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(100));
|
|
|
|
});
|
2020-04-23 03:05:34 +00:00
|
|
|
|
|
|
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
|
|
|
|
|
|
|
AddAssert("note start time > 0", () => getNote().StartTime > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Note getNote() => this.ChildrenOfType<DrawableNote>().FirstOrDefault()?.HitObject;
|
|
|
|
|
2018-11-12 10:41:06 +00:00
|
|
|
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableNote((Note)hitObject);
|
|
|
|
protected override PlacementBlueprint CreateBlueprint() => new NotePlacementBlueprint();
|
|
|
|
}
|
|
|
|
}
|