1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Make OsuButton abstract

This commit is contained in:
Dean Herbert 2022-12-13 22:13:48 +09:00
parent edc78205d5
commit efe057176e
2 changed files with 2 additions and 49 deletions

View File

@ -1,47 +0,0 @@
// 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.
#nullable disable
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneOsuButton : OsuTestScene
{
[Test]
public void TestToggleEnabled()
{
OsuButton button = null;
AddStep("add button", () => Child = button = new OsuButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200),
Text = "Button"
});
AddToggleStep("toggle enabled", toggle =>
{
for (int i = 0; i < 6; i++)
button.Action = toggle ? () => { } : null;
});
}
[Test]
public void TestInitiallyDisabled()
{
AddStep("add button", () => Child = new OsuButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200),
Text = "Button"
});
}
}
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
/// <summary>
/// A button with added default sound effects.
/// </summary>
public partial class OsuButton : Button
public abstract partial class OsuButton : Button
{
public LocalisableString Text
{
@ -73,7 +73,7 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box flashLayer;
public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Button)
protected OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Button)
{
Height = 40;