// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling.Algorithms; using osu.Game.Tests.Visual; using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Tests.Skinning { /// /// A test scene for skinnable mania components. /// public abstract partial class ManiaSkinnableTestScene : SkinnableTestScene { [Cached(Type = typeof(IScrollingInfo))] protected readonly TestScrollingInfo ScrollingInfo = new TestScrollingInfo(); [Cached] private readonly StageDefinition stage = new StageDefinition(4); protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset(); protected ManiaSkinnableTestScene() { ScrollingInfo.Direction.Value = ScrollingDirection.Down; Add(new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray.Opacity(0.2f), Depth = 1 }); } [Test] public void TestScrollingDown() { AddStep("change direction to down", () => ScrollingInfo.Direction.Value = ScrollingDirection.Down); } [Test] public void TestScrollingUp() { AddStep("change direction to up", () => ScrollingInfo.Direction.Value = ScrollingDirection.Up); } protected class TestScrollingInfo : IScrollingInfo { public readonly Bindable Direction = new Bindable(); IBindable IScrollingInfo.Direction => Direction; IBindable IScrollingInfo.TimeRange { get; } = new Bindable(5000); IBindable IScrollingInfo.Algorithm { get; } = new Bindable(new ConstantScrollAlgorithm()); } } }