1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Add test case for distance spacing hotkeys scrolling behaviour

This commit is contained in:
Salman Ahmed 2022-01-18 18:30:31 +03:00
parent 528dc03b8c
commit 9504942cfd
2 changed files with 31 additions and 0 deletions

View File

@ -8,6 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
@ -21,6 +22,7 @@ using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components.RadioButtons;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Editing
{
@ -86,6 +88,28 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType<ComposeBlueprintContainer>().First().CurrentTool is HitCircleCompositionTool);
}
[Test]
public void TestDistanceSpacingHotkeys()
{
float originalSpacing = 0;
AddStep("retrieve original spacing", () => originalSpacing = (float)editorBeatmap.BeatmapInfo.DistanceSpacing);
AddStep("hold alt", () => InputManager.PressKey(Key.LAlt));
AddStep("hold D", () => InputManager.PressKey(Key.D));
AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5));
AddAssert("distance spacing increased by 0.5", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.5f));
AddStep("hold shift", () => InputManager.PressKey(Key.LShift));
AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5));
AddAssert("distance spacing increased by 0.05", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.55f));
AddStep("release shift", () => InputManager.ReleaseKey(Key.LShift));
AddStep("release alt", () => InputManager.ReleaseKey(Key.LAlt));
AddStep("release D", () => InputManager.ReleaseKey(Key.D));
}
public class EditorBeatmapContainer : Container
{
private readonly IWorkingBeatmap working;

View File

@ -22,6 +22,11 @@ namespace osu.Game.Overlays
{
public class SettingsToolboxGroup : Container, IExpandable
{
/// <summary>
/// The title of this toolbox group.
/// </summary>
public string Title { get; }
private const float transition_duration = 250;
private const int container_width = 270;
private const int border_thickness = 2;
@ -48,6 +53,8 @@ namespace osu.Game.Overlays
/// <param name="title">The title to be displayed in the header of this group.</param>
public SettingsToolboxGroup(string title)
{
Title = title;
AutoSizeAxes = Axes.Y;
Width = container_width;
Masking = true;