2019-01-24 16:43:03 +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.
|
2018-06-07 15:08:37 +08:00
|
|
|
|
|
2024-07-08 22:25:19 +08:00
|
|
|
|
using System.Linq;
|
2018-06-07 15:08:37 +08:00
|
|
|
|
using NUnit.Framework;
|
2018-07-19 18:30:20 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2021-12-24 02:02:10 +08:00
|
|
|
|
using osu.Framework.Extensions.ObjectExtensions;
|
2024-07-08 22:25:19 +08:00
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-07-19 18:30:20 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.Configuration;
|
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2024-07-08 22:25:19 +08:00
|
|
|
|
using osu.Game.Screens.Edit.Timing;
|
2018-06-07 15:08:37 +08:00
|
|
|
|
using osu.Game.Tests.Visual;
|
2024-07-08 22:25:19 +08:00
|
|
|
|
using osuTK.Input;
|
2018-06-07 15:08:37 +08:00
|
|
|
|
|
2020-09-25 17:48:04 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
2018-06-07 15:08:37 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class TestSceneEditor : EditorTestScene
|
2018-06-07 15:08:37 +08:00
|
|
|
|
{
|
2018-07-19 18:30:20 +08:00
|
|
|
|
private readonly Bindable<ManiaScrollingDirection> direction = new Bindable<ManiaScrollingDirection>();
|
|
|
|
|
|
2020-06-04 05:47:10 +08:00
|
|
|
|
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public TestSceneEditor()
|
2018-06-07 15:08:37 +08:00
|
|
|
|
{
|
2018-07-19 18:30:20 +08:00
|
|
|
|
AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up);
|
|
|
|
|
AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2021-12-24 02:34:41 +08:00
|
|
|
|
private void load()
|
2018-07-19 18:30:20 +08:00
|
|
|
|
{
|
2021-12-24 02:34:41 +08:00
|
|
|
|
var config = (ManiaRulesetConfigManager)RulesetConfigs.GetConfigFor(Ruleset.Value.CreateInstance()).AsNonNull();
|
2019-01-25 18:14:37 +08:00
|
|
|
|
config.BindWith(ManiaRulesetSetting.ScrollDirection, direction);
|
2018-06-07 15:08:37 +08:00
|
|
|
|
}
|
2024-07-08 22:25:19 +08:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestReloadOnBPMChange()
|
|
|
|
|
{
|
|
|
|
|
HitObjectComposer oldComposer = null!;
|
|
|
|
|
|
|
|
|
|
AddStep("store composer", () => oldComposer = this.ChildrenOfType<HitObjectComposer>().Single());
|
|
|
|
|
AddUntilStep("composer stored", () => oldComposer, () => Is.Not.Null);
|
|
|
|
|
AddStep("switch to timing tab", () => InputManager.Key(Key.F3));
|
|
|
|
|
AddUntilStep("wait for loaded", () => this.ChildrenOfType<TimingAdjustButton>().ElementAtOrDefault(1), () => Is.Not.Null);
|
|
|
|
|
AddStep("change timing point BPM", () =>
|
|
|
|
|
{
|
|
|
|
|
var bpmControl = this.ChildrenOfType<TimingAdjustButton>().ElementAt(1);
|
|
|
|
|
InputManager.MoveMouseTo(bpmControl);
|
|
|
|
|
InputManager.Click(MouseButton.Left);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddStep("switch back to composer", () => InputManager.Key(Key.F1));
|
|
|
|
|
AddUntilStep("composer reloaded", () =>
|
|
|
|
|
{
|
|
|
|
|
var composer = this.ChildrenOfType<HitObjectComposer>().SingleOrDefault();
|
|
|
|
|
return composer != null && composer != oldComposer;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddStep("store composer", () => oldComposer = this.ChildrenOfType<HitObjectComposer>().Single());
|
|
|
|
|
AddUntilStep("composer stored", () => oldComposer, () => Is.Not.Null);
|
|
|
|
|
AddStep("undo", () =>
|
|
|
|
|
{
|
|
|
|
|
InputManager.PressKey(Key.ControlLeft);
|
|
|
|
|
InputManager.Key(Key.Z);
|
|
|
|
|
InputManager.ReleaseKey(Key.ControlLeft);
|
|
|
|
|
});
|
|
|
|
|
AddUntilStep("composer reloaded", () =>
|
|
|
|
|
{
|
|
|
|
|
var composer = this.ChildrenOfType<HitObjectComposer>().SingleOrDefault();
|
|
|
|
|
return composer != null && composer != oldComposer;
|
|
|
|
|
});
|
|
|
|
|
}
|
2018-06-07 15:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|