mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:12:57 +08:00
Add test case for distance spacing hotkeys scrolling behaviour
This commit is contained in:
parent
528dc03b8c
commit
9504942cfd
@ -8,6 +8,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Edit;
|
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.Components.RadioButtons;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
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);
|
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
|
public class EditorBeatmapContainer : Container
|
||||||
{
|
{
|
||||||
private readonly IWorkingBeatmap working;
|
private readonly IWorkingBeatmap working;
|
||||||
|
@ -22,6 +22,11 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public class SettingsToolboxGroup : Container, IExpandable
|
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 float transition_duration = 250;
|
||||||
private const int container_width = 270;
|
private const int container_width = 270;
|
||||||
private const int border_thickness = 2;
|
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>
|
/// <param name="title">The title to be displayed in the header of this group.</param>
|
||||||
public SettingsToolboxGroup(string title)
|
public SettingsToolboxGroup(string title)
|
||||||
{
|
{
|
||||||
|
Title = title;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Width = container_width;
|
Width = container_width;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user