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] [Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
[Test] [TestCase(false)]
public void TestShearedButton() [TestCase(true)]
public void TestShearedButton(bool bigButton)
{ {
ShearedButton button = null; ShearedButton button = null;
bool actionFired = false; bool actionFired = false;
@ -26,17 +27,35 @@ public void TestShearedButton()
{ {
actionFired = false; actionFired = false;
Child = button = new ShearedButton(200) if (bigButton)
{ {
LighterColour = Colour4.FromHex("#FF86DD"), Child = button = new ShearedButton(400)
DarkerColour = Colour4.FromHex("#DE31AE"), {
TextColour = Colour4.White, LighterColour = Colour4.FromHex("#FFFFFF"),
Anchor = Anchor.Centre, DarkerColour = Colour4.FromHex("#FFCC22"),
Origin = Anchor.Centre, TextColour = Colour4.Black,
Text = "Press me", TextSize = 36,
Height = 80, Anchor = Anchor.Centre,
Action = () => actionFired = true, 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); AddStep("set disabled", () => button.Enabled.Value = false);

View File

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