extend TestCaseSpinner with new steps

- Hidden, Size and Scale
This commit is contained in:
Aergwyn
2017-12-28 18:21:08 +01:00
parent 8d5f4d4f19
commit ca650e8d48
3 changed files with 23 additions and 5 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private bool hidden; private bool hidden;
private int depthIndex; private int depthIndex;
private int circleSize; private int circleSize;
private float circleScale; private float circleScale = 1;
public TestCaseHitCircle() public TestCaseHitCircle()
{ {

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private int repeats; private int repeats;
private int depthIndex; private int depthIndex;
private int circleSize; private int circleSize;
private float circleScale; private float circleScale = 1;
private double speedMultiplier = 2; private double speedMultiplier = 2;
private double sliderMultiplier = 2; private double sliderMultiplier = 2;

View File

@ -2,10 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using NUnit.Framework; using NUnit.Framework;
using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -18,28 +21,43 @@ namespace osu.Game.Rulesets.Osu.Tests
private readonly Container content; private readonly Container content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private bool hidden;
private int depthIndex; private int depthIndex;
private int circleSize;
private float circleScale = 1;
public TestCaseSpinner() public TestCaseSpinner()
{ {
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
AddStep("Single", addSingle); AddStep("Single", testSingle);
AddToggleStep("Hidden", v => hidden = v);
AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s);
AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s);
} }
private void addSingle() private void testSingle()
{ {
var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 };
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
var drawable = new DrawableSpinner(spinner) var drawable = new DrawableSpinner(spinner)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Scale = new Vector2(circleScale),
Depth = depthIndex++ Depth = depthIndex++
}; };
if (hidden)
drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence;
Add(drawable); Add(drawable);
} }
private class TestOsuModHidden : OsuModHidden
{
public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state);
}
} }
} }