1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 10:17:24 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayRulesetSelector.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
3.3 KiB
C#
Raw Normal View History

2020-01-02 03:49:04 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-01-02 03:49:04 +08:00
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
using osu.Framework.Bindables;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Framework.Allocation;
2020-01-02 03:49:04 +08:00
namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneOverlayRulesetSelector : OsuTestScene
{
private readonly OverlayRulesetSelector selector;
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public TestSceneOverlayRulesetSelector()
{
Add(new FillFlowContainer
2020-01-02 03:49:04 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5),
Children = new[]
{
new ColourProvidedContainer(OverlayColourScheme.Green, selector = new OverlayRulesetSelector { Current = ruleset }),
new ColourProvidedContainer(OverlayColourScheme.Blue, new OverlayRulesetSelector { Current = ruleset }),
new ColourProvidedContainer(OverlayColourScheme.Orange, new OverlayRulesetSelector { Current = ruleset }),
new ColourProvidedContainer(OverlayColourScheme.Pink, new OverlayRulesetSelector { Current = ruleset }),
new ColourProvidedContainer(OverlayColourScheme.Purple, new OverlayRulesetSelector { Current = ruleset }),
new ColourProvidedContainer(OverlayColourScheme.Red, new OverlayRulesetSelector { Current = ruleset }),
}
2020-01-02 03:49:04 +08:00
});
}
private partial class ColourProvidedContainer : Container
{
[Cached]
private readonly OverlayColourProvider colourProvider;
public ColourProvidedContainer(OverlayColourScheme colourScheme, OverlayRulesetSelector rulesetSelector)
{
colourProvider = new OverlayColourProvider(colourScheme);
AutoSizeAxes = Axes.Both;
Add(rulesetSelector);
}
}
2020-01-02 03:49:04 +08:00
[Test]
public void TestSelection()
{
AddStep("Select osu!", () => ruleset.Value = new OsuRuleset().RulesetInfo);
AddAssert("Check osu! selected", () => selector.Current.Value.Equals(new OsuRuleset().RulesetInfo));
2020-01-02 03:49:04 +08:00
AddStep("Select mania", () => ruleset.Value = new ManiaRuleset().RulesetInfo);
AddAssert("Check mania selected", () => selector.Current.Value.Equals(new ManiaRuleset().RulesetInfo));
2020-01-02 03:49:04 +08:00
AddStep("Select taiko", () => ruleset.Value = new TaikoRuleset().RulesetInfo);
AddAssert("Check taiko selected", () => selector.Current.Value.Equals(new TaikoRuleset().RulesetInfo));
2020-01-02 03:49:04 +08:00
AddStep("Select catch", () => ruleset.Value = new CatchRuleset().RulesetInfo);
AddAssert("Check catch selected", () => selector.Current.Value.Equals(new CatchRuleset().RulesetInfo));
}
2020-01-02 03:49:04 +08:00
}
}