1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Merge branch 'master' into fix-catch-distance-snap-grid

This commit is contained in:
Salman Ahmed 2023-10-26 17:44:33 +03:00 committed by GitHub
commit c51513705a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 27 deletions

View File

@ -18,26 +18,24 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private OverlayColourProvider colourProvider { get; set; } = new OverlayColourProvider(OverlayColourScheme.Purple);
private readonly BindableDouble current = new BindableDouble(5)
{
Precision = 0.1f,
MinValue = 0,
MaxValue = 15
};
private RoundedSliderBar<double> slider = null!;
[BackgroundDependencyLoader]
private void load()
[SetUpSteps]
public void SetUpSteps()
{
Child = slider = new RoundedSliderBar<double>
AddStep("create slider", () => Child = slider = new RoundedSliderBar<double>
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Current = current,
Current = new BindableDouble(5)
{
Precision = 0.1,
MinValue = 0,
MaxValue = 15
},
RelativeSizeAxes = Axes.X,
Width = 0.4f
};
});
}
[Test]
@ -55,5 +53,22 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("slider is default", () => slider.Current.IsDefault);
}
[Test]
public void TestNubDoubleClickOnDisabledSliderDoesNothing()
{
AddStep("set slider to 1", () => slider.Current.Value = 1);
AddStep("disable slider", () => slider.Current.Disabled = true);
AddStep("move mouse to nub", () => InputManager.MoveMouseTo(slider.ChildrenOfType<Nub>().Single()));
AddStep("double click nub", () =>
{
InputManager.Click(MouseButton.Left);
InputManager.Click(MouseButton.Left);
});
AddAssert("slider is still at 1", () => slider.Current.Value, () => Is.EqualTo(1));
}
}
}

View File

@ -18,26 +18,24 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private OverlayColourProvider colourProvider { get; set; } = new OverlayColourProvider(OverlayColourScheme.Purple);
private readonly BindableDouble current = new BindableDouble(5)
{
Precision = 0.1f,
MinValue = 0,
MaxValue = 15
};
private ShearedSliderBar<double> slider = null!;
[BackgroundDependencyLoader]
private void load()
[SetUpSteps]
public void SetUpSteps()
{
Child = slider = new ShearedSliderBar<double>
AddStep("create slider", () => Child = slider = new ShearedSliderBar<double>
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Current = current,
Current = new BindableDouble(5)
{
Precision = 0.1,
MinValue = 0,
MaxValue = 15
},
RelativeSizeAxes = Axes.X,
Width = 0.4f
};
});
}
[Test]
@ -55,5 +53,22 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("slider is default", () => slider.Current.IsDefault);
}
[Test]
public void TestNubDoubleClickOnDisabledSliderDoesNothing()
{
AddStep("set slider to 1", () => slider.Current.Value = 1);
AddStep("disable slider", () => slider.Current.Disabled = true);
AddStep("move mouse to nub", () => InputManager.MoveMouseTo(slider.ChildrenOfType<ShearedNub>().Single()));
AddStep("double click nub", () =>
{
InputManager.Click(MouseButton.Left);
InputManager.Click(MouseButton.Left);
});
AddAssert("slider is still at 1", () => slider.Current.Value, () => Is.EqualTo(1));
}
}
}

View File

@ -98,7 +98,11 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.X,
Current = { Value = true },
OnDoubleClicked = () => Current.SetDefault(),
OnDoubleClicked = () =>
{
if (!Current.Disabled)
Current.SetDefault();
},
},
},
hoverClickSounds = new HoverClickSounds()

View File

@ -101,7 +101,11 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.X,
Current = { Value = true },
OnDoubleClicked = () => Current.SetDefault(),
OnDoubleClicked = () =>
{
if (!Current.Disabled)
Current.SetDefault();
},
},
},
hoverClickSounds = new HoverClickSounds()

View File

@ -149,6 +149,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
new KeyBinding(InputKey.ExtraMouseButton2, GlobalAction.SkipCutscene),
new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry),
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.QuickRetry),
new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit),
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.DecreaseScrollSpeed),
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.IncreaseScrollSpeed),

View File

@ -39,7 +39,8 @@
<PackageReference Include="ppy.osu.Framework" Version="2023.1012.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1023.0" />
<PackageReference Include="Sentry" Version="3.40.0" />
<PackageReference Include="SharpCompress" Version="0.34.1" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.33.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.6" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />