mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Update TestSceneRoundedButton
with new colour assertions
This commit is contained in:
@ -5,9 +5,12 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
@ -15,14 +18,31 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
private readonly BindableBool enabled = new BindableBool(true);
|
private readonly BindableBool enabled = new BindableBool(true);
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new RoundedButton
|
protected override Drawable CreateContent()
|
||||||
|
{
|
||||||
|
return new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new RoundedButton
|
||||||
{
|
{
|
||||||
Width = 400,
|
Width = 400,
|
||||||
Text = "Test button",
|
Text = "Test button",
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Enabled = { BindTarget = enabled },
|
Enabled = { BindTarget = enabled },
|
||||||
|
},
|
||||||
|
new SettingsButton
|
||||||
|
{
|
||||||
|
Text = "Test button",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Enabled = { BindTarget = enabled },
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDisabled()
|
public void TestDisabled()
|
||||||
@ -34,7 +54,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestBackgroundColour()
|
public void TestBackgroundColour()
|
||||||
{
|
{
|
||||||
AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user