1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Update TestSceneRoundedButton with new colour assertions

This commit is contained in:
Dean Herbert 2022-05-24 18:42:40 +09:00
parent f00dd27fcd
commit 33fd1555f2

View File

@ -5,9 +5,12 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
namespace osu.Game.Tests.Visual.UserInterface
{
@ -15,14 +18,31 @@ namespace osu.Game.Tests.Visual.UserInterface
{
private readonly BindableBool enabled = new BindableBool(true);
protected override Drawable CreateContent() => new RoundedButton
protected override Drawable CreateContent()
{
Width = 400,
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
};
return new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new RoundedButton
{
Width = 400,
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
},
new SettingsButton
{
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
},
}
};
}
[Test]
public void TestDisabled()
@ -34,7 +54,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public void TestBackgroundColour()
{
AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red));
AddAssert("first button has correct colour", () => Cell(0, 1).ChildrenOfType<RoundedButton>().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1);
AddAssert("rounded button has correct colour", () => Cell(0, 1).ChildrenOfType<RoundedButton>().First().BackgroundColour == new OsuColour().Blue3);
AddAssert("settings button has correct colour", () => Cell(0, 1).ChildrenOfType<SettingsButton>().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1);
}
}
}