diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs index 86a977fd3f..216c35de65 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs @@ -10,6 +10,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; @@ -26,6 +28,7 @@ namespace osu.Game.Tests.Visual.Editing private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); private TimingScreen timingScreen; + private EditorBeatmap editorBeatmap; protected override bool ScrollUsingMouseWheel => false; @@ -35,8 +38,11 @@ namespace osu.Game.Tests.Visual.Editing Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); Beatmap.Disabled = true; + } - var editorBeatmap = new EditorBeatmap(Beatmap.Value.GetPlayableBeatmap(Ruleset.Value)); + private void reloadEditorBeatmap() + { + editorBeatmap = new EditorBeatmap(Beatmap.Value.GetPlayableBeatmap(Ruleset.Value)); Child = new DependencyProvidingContainer { @@ -58,7 +64,9 @@ namespace osu.Game.Tests.Visual.Editing { AddStep("Stop clock", () => EditorClock.Stop()); - AddUntilStep("wait for rows to load", () => Child.ChildrenOfType().Any()); + AddStep("Reload Editor Beatmap", reloadEditorBeatmap); + + AddUntilStep("Wait for rows to load", () => Child.ChildrenOfType().Any()); } [Test] @@ -95,6 +103,37 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 69670); } + [Test] + public void TestScrollControlGroupIntoView() + { + AddStep("Add many control points", () => + { + editorBeatmap.ControlPointInfo.Clear(); + + editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()); + + for (int i = 0; i < 100; i++) + { + editorBeatmap.ControlPointInfo.Add((i + 1) * 1000, new EffectControlPoint + { + KiaiMode = Convert.ToBoolean(i % 2), + }); + } + }); + + AddStep("Select first effect point", () => + { + InputManager.MoveMouseTo(Child.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + + AddStep("Seek to beginning", () => EditorClock.Seek(0)); + + AddStep("Seek to last point", () => EditorClock.Seek(101 * 1000)); + + AddUntilStep("Scrolled to end", () => timingScreen.ChildrenOfType().First().IsScrolledToEnd()); + } + protected override void Dispose(bool isDisposing) { Beatmap.Disabled = false;