mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Setup drumroll testing
This commit is contained in:
parent
019e777d7d
commit
18c28390ef
@ -0,0 +1,84 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneDrawableDrumRoll : TaikoSkinnableTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableDrumRoll),
|
||||||
|
typeof(DrawableDrumRollTick),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
[Cached(typeof(IScrollingInfo))]
|
||||||
|
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
|
||||||
|
{
|
||||||
|
Direction = { Value = ScrollingDirection.Left },
|
||||||
|
TimeRange = { Value = 5000 },
|
||||||
|
};
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AddStep("Drum roll", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var hoc = new ScrollingHitObjectContainer();
|
||||||
|
|
||||||
|
hoc.Add(new DrawableDrumRoll(createDrumRollAtCurrentTime())
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 500,
|
||||||
|
});
|
||||||
|
|
||||||
|
return hoc;
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("Drum roll (strong)", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var hoc = new ScrollingHitObjectContainer();
|
||||||
|
|
||||||
|
hoc.Add(new DrawableDrumRoll(createDrumRollAtCurrentTime(true))
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 500,
|
||||||
|
});
|
||||||
|
|
||||||
|
return hoc;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrumRoll createDrumRollAtCurrentTime(bool strong = false)
|
||||||
|
{
|
||||||
|
var drumroll = new DrumRoll
|
||||||
|
{
|
||||||
|
IsStrong = strong,
|
||||||
|
StartTime = Time.Current + 1000,
|
||||||
|
Duration = 4000,
|
||||||
|
};
|
||||||
|
|
||||||
|
var cpi = new ControlPointInfo();
|
||||||
|
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
|
||||||
|
drumroll.ApplyDefaults(cpi, new BeatmapDifficulty());
|
||||||
|
|
||||||
|
return drumroll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
public void Flip() => scrollingInfo.Direction.Value = scrollingInfo.Direction.Value == ScrollingDirection.Up ? ScrollingDirection.Down : ScrollingDirection.Up;
|
public void Flip() => scrollingInfo.Direction.Value = scrollingInfo.Direction.Value == ScrollingDirection.Up ? ScrollingDirection.Down : ScrollingDirection.Up;
|
||||||
|
|
||||||
private class TestScrollingInfo : IScrollingInfo
|
public class TestScrollingInfo : IScrollingInfo
|
||||||
{
|
{
|
||||||
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||||
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
|
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
|
||||||
@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
IScrollAlgorithm IScrollingInfo.Algorithm => Algorithm;
|
IScrollAlgorithm IScrollingInfo.Algorithm => Algorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestScrollAlgorithm : IScrollAlgorithm
|
public class TestScrollAlgorithm : IScrollAlgorithm
|
||||||
{
|
{
|
||||||
public readonly SortedList<MultiplierControlPoint> ControlPoints = new SortedList<MultiplierControlPoint>();
|
public readonly SortedList<MultiplierControlPoint> ControlPoints = new SortedList<MultiplierControlPoint>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user