Expose font size and add big button test

This commit is contained in:
Dean Herbert 2022-04-26 18:14:57 +09:00
parent cd197a9380
commit 52a8f3848d
2 changed files with 37 additions and 12 deletions

View File

@ -16,8 +16,9 @@ public class TestSceneShearedButtons : OsuManualInputManagerTestScene
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
[Test]
public void TestShearedButton()
[TestCase(false)]
[TestCase(true)]
public void TestShearedButton(bool bigButton)
{
ShearedButton button = null;
bool actionFired = false;
@ -26,17 +27,35 @@ public void TestShearedButton()
{
actionFired = false;
Child = button = new ShearedButton(200)
if (bigButton)
{
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,
};
Child = button = new ShearedButton(400)
{
LighterColour = Colour4.FromHex("#FFFFFF"),
DarkerColour = Colour4.FromHex("#FFCC22"),
TextColour = Colour4.Black,
TextSize = 36,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Let's GO!",
Height = 80,
Action = () => actionFired = true,
};
}
else
{
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);

View File

@ -23,6 +23,12 @@ public LocalisableString Text
set => text.Text = value;
}
public float TextSize
{
get => text.Font.Size;
set => text.Font = OsuFont.TorusAlternate.With(size: value);
}
public Colour4 DarkerColour
{
set