mirror of
https://github.com/ppy/osu.git
synced 2026-05-13 19:54:15 +08:00
a996261304
It's been a while. Notes: - `SharpCompress` usages changed a bit. Manually adjusted these, mostly just renames or adjusted parameters. - nUnit 3 -> 4 migrated using https://gist.github.com/peppy/07994386d793a117350cb5f24b156585. there's a mode in this script to update to the newer `Assert.That` syntax but it requires fixes and couldn't really be bothered. - DeepEqual nuked as the only usage was on a disabled test. The reason it's disabled has been merged upstream, but it's failing for other (realm) reasons which I don't think is worthwhile to investigate for now. - This bumps Moq. I think the author is back in a sensible headspace and the new version has the stupid shit removed, so probably okay? Nice to be on a level playing field with packages for once in a long time. - Automapper is silly, but we've discussed this elsewhere. - `TestRealmKeyBindingStore` failures are a wildcard, but fixed by using a more standardised testing method. Dunno why, don't care. --------- Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
68 lines
2.7 KiB
C#
68 lines
2.7 KiB
C#
// 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;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Testing;
|
|
using osu.Game.Configuration;
|
|
using osu.Game.Rulesets.Mania.UI;
|
|
using osu.Game.Tests.Visual;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|
{
|
|
public partial class TestSceneObjectPlacement : EditorTestScene
|
|
{
|
|
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
|
|
|
|
[Resolved]
|
|
private OsuConfigManager config { get; set; } = null!;
|
|
|
|
[Test]
|
|
public void TestPlacementBeforeTrackStart()
|
|
{
|
|
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()
|
|
{
|
|
double? initialTime = null;
|
|
|
|
AddStep("store initial time", () => initialTime = EditorClock.CurrentTime);
|
|
AddStep("change seek setting to true", () => config.SetValue(OsuSetting.EditorAutoSeekOnPlacement, true));
|
|
placeObject();
|
|
AddUntilStep("wait for seek to complete", () => !EditorClock.IsSeeking);
|
|
AddAssert("seeked forward to object", () => EditorClock.CurrentTime, () => Is.GreaterThan(initialTime!));
|
|
}
|
|
|
|
[Test]
|
|
public void TestNoSeekOnNotePlacement()
|
|
{
|
|
double? initialTime = null;
|
|
|
|
AddStep("store initial time", () => initialTime = EditorClock.CurrentTime);
|
|
AddStep("change seek setting to false", () => config.SetValue(OsuSetting.EditorAutoSeekOnPlacement, false));
|
|
placeObject();
|
|
AddAssert("not seeking", () => !EditorClock.IsSeeking);
|
|
AddAssert("time is unchanged", () => EditorClock.CurrentTime, () => Is.EqualTo(initialTime));
|
|
}
|
|
|
|
private void placeObject()
|
|
{
|
|
AddStep("select note placement tool", () => InputManager.Key(Key.Number2));
|
|
AddStep("move mouse to centre of last column", () => InputManager.MoveMouseTo(this.ChildrenOfType<Column>().Last().ScreenSpaceDrawQuad.Centre));
|
|
AddStep("place note", () => InputManager.Click(MouseButton.Left));
|
|
}
|
|
}
|
|
}
|