mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:12:57 +08:00
Add ShearedButton
test coverage
This commit is contained in:
parent
9f33e627de
commit
6864623bac
@ -16,6 +16,38 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Cached]
|
[Cached]
|
||||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
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]
|
[Test]
|
||||||
public void TestShearedToggleButton()
|
public void TestShearedToggleButton()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user