mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add failing test case
This commit is contained in:
@ -2,11 +2,16 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
@ -22,15 +27,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Colour4.DarkGray
|
|
||||||
},
|
|
||||||
button = new RoundedButton
|
button = new RoundedButton
|
||||||
{
|
{
|
||||||
Width = 400,
|
Width = 400,
|
||||||
Text = "Test button",
|
Text = "Test Button",
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Action = () => { }
|
Action = () => { }
|
||||||
@ -40,5 +40,39 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddToggleStep("toggle disabled", disabled => button.Action = disabled ? (Action)null : () => { });
|
AddToggleStep("toggle disabled", disabled => button.Action = disabled ? (Action)null : () => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOverlay()
|
||||||
|
{
|
||||||
|
IEnumerable<OverlayColourScheme> schemes = Enum.GetValues(typeof(OverlayColourScheme)).Cast<OverlayColourScheme>();
|
||||||
|
|
||||||
|
AddStep("create buttons", () =>
|
||||||
|
{
|
||||||
|
Child = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(5f),
|
||||||
|
ChildrenEnumerable = schemes.Select(c => new DependencyProvidingContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
CachedDependencies = new (Type, object)[] { (typeof(OverlayColourProvider), new OverlayColourProvider(c)) },
|
||||||
|
Child = new RoundedButton
|
||||||
|
{
|
||||||
|
Width = 400,
|
||||||
|
Text = $"Test {c}",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Action = () => { },
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("first button has correct colour", () => this.ChildrenOfType<RoundedButton>().First().BackgroundColour == new OverlayColourProvider(schemes.First()).Highlight1);
|
||||||
|
AddToggleStep("toggle disabled", disabled => this.ChildrenOfType<RoundedButton>().ForEach(b => b.Action = disabled ? (Action)null : () => { }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user