2017-12-27 19:01:20 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-12-27 19:41:59 +08:00
|
|
|
|
using NUnit.Framework;
|
2017-12-29 01:21:08 +08:00
|
|
|
|
using OpenTK;
|
2017-12-27 19:01:20 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2017-12-29 01:21:08 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
2017-12-27 19:01:20 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests
|
|
|
|
|
{
|
2017-12-27 19:41:59 +08:00
|
|
|
|
[Ignore("getting CI working")]
|
2017-12-27 19:01:20 +08:00
|
|
|
|
public class TestCaseSpinner : OsuTestCase
|
|
|
|
|
{
|
|
|
|
|
private readonly Container content;
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2017-12-29 01:21:08 +08:00
|
|
|
|
private bool hidden;
|
2017-12-27 19:01:20 +08:00
|
|
|
|
private int depthIndex;
|
2017-12-29 01:21:08 +08:00
|
|
|
|
private int circleSize;
|
|
|
|
|
private float circleScale = 1;
|
2017-12-27 19:01:20 +08:00
|
|
|
|
|
|
|
|
|
public TestCaseSpinner()
|
|
|
|
|
{
|
|
|
|
|
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
|
|
|
|
|
2017-12-29 01:21:08 +08:00
|
|
|
|
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);
|
2017-12-27 19:01:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-29 01:21:08 +08:00
|
|
|
|
private void testSingle()
|
2017-12-27 19:01:20 +08:00
|
|
|
|
{
|
|
|
|
|
var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 };
|
|
|
|
|
|
2017-12-29 01:21:08 +08:00
|
|
|
|
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
2017-12-27 19:01:20 +08:00
|
|
|
|
|
|
|
|
|
var drawable = new DrawableSpinner(spinner)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
2017-12-29 01:21:08 +08:00
|
|
|
|
Scale = new Vector2(circleScale),
|
2017-12-27 19:01:20 +08:00
|
|
|
|
Depth = depthIndex++
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-29 01:21:08 +08:00
|
|
|
|
if (hidden)
|
|
|
|
|
drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence;
|
|
|
|
|
|
2017-12-27 19:01:20 +08:00
|
|
|
|
Add(drawable);
|
|
|
|
|
}
|
2017-12-29 01:21:08 +08:00
|
|
|
|
|
|
|
|
|
private class TestOsuModHidden : OsuModHidden
|
|
|
|
|
{
|
2017-12-29 15:22:06 +08:00
|
|
|
|
public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state);
|
2017-12-29 01:21:08 +08:00
|
|
|
|
}
|
2017-12-27 19:01:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|