mirror of https://github.com/ppy/osu
Update `TestSceneRoundedButton` with new colour assertions
This commit is contained in:
parent
f00dd27fcd
commit
33fd1555f2
|
@ -5,9 +5,12 @@
|
|||
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 @@ public class TestSceneRoundedButton : ThemeComparisonTestScene
|
|||
{
|
||||
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 @@ public void TestDisabled()
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue