osu/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs

65 lines
2.2 KiB
C#
Raw Normal View History

2023-06-22 16:37:25 +00:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2020-03-30 14:02:07 +00:00
// 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;
2020-03-30 14:02:07 +00:00
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
{
/// <summary>
/// A test scene for skinnable mania components.
/// </summary>
2022-11-24 05:32:20 +00:00
public abstract partial class ManiaSkinnableTestScene : SkinnableTestScene
2020-03-30 14:02:07 +00:00
{
[Cached(Type = typeof(IScrollingInfo))]
2024-08-20 03:28:36 +00:00
protected readonly TestScrollingInfo ScrollingInfo = new TestScrollingInfo();
2020-03-30 14:02:07 +00:00
[Cached]
private readonly StageDefinition stage = new StageDefinition(4);
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
2020-03-30 14:02:07 +00:00
protected ManiaSkinnableTestScene()
{
2024-08-20 03:28:36 +00:00
ScrollingInfo.Direction.Value = ScrollingDirection.Down;
2020-03-30 14:02:07 +00:00
Add(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.SlateGray.Opacity(0.2f),
Depth = 1
});
}
[Test]
public void TestScrollingDown()
{
2024-08-20 03:28:36 +00:00
AddStep("change direction to down", () => ScrollingInfo.Direction.Value = ScrollingDirection.Down);
2020-03-30 14:02:07 +00:00
}
[Test]
public void TestScrollingUp()
{
2024-08-20 03:28:36 +00:00
AddStep("change direction to up", () => ScrollingInfo.Direction.Value = ScrollingDirection.Up);
2020-03-30 14:02:07 +00:00
}
2024-08-20 03:28:36 +00:00
protected class TestScrollingInfo : IScrollingInfo
2020-03-30 14:02:07 +00:00
{
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
2021-09-15 06:22:27 +00:00
IBindable<double> IScrollingInfo.TimeRange { get; } = new Bindable<double>(5000);
2023-08-15 11:38:17 +00:00
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm { get; } = new Bindable<IScrollAlgorithm>(new ConstantScrollAlgorithm());
2020-03-30 14:02:07 +00:00
}
}
}