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

Add ShearedButton test coverage

This commit is contained in:
Dean Herbert 2022-04-26 17:32:02 +09:00
parent 9f33e627de
commit 6864623bac

View File

@ -16,6 +16,38 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
[Test]
public void TestShearedButton()
{
ShearedButton button = null;
bool actionFired = false;
AddStep("create button", () =>
{
actionFired = false;
Child = button = new ShearedButton(200)
{
LighterColour = Colour4.FromHex("#FF86DD"),
DarkerColour = Colour4.FromHex("#DE31AE"),
TextColour = Colour4.White,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Press me",
Height = 80,
Action = () => actionFired = true,
};
});
AddStep("set disabled", () => button.Enabled.Value = false);
AddStep("press button", () => button.TriggerClick());
AddAssert("action not fired", () => !actionFired);
AddStep("set enabled", () => button.Enabled.Value = true);
AddStep("press button", () => button.TriggerClick());
AddAssert("action fired", () => actionFired);
}
[Test]
public void TestShearedToggleButton()
{