2020-08-11 19:28:00 +00:00
|
|
|
// 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.
|
|
|
|
|
2020-08-11 19:55:50 +00:00
|
|
|
using System;
|
2020-08-11 19:28:00 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Testing;
|
2020-08-11 19:55:50 +00:00
|
|
|
using osu.Framework.Utils;
|
2020-08-11 19:28:00 +00:00
|
|
|
using osu.Game.Beatmaps;
|
2020-08-11 19:55:50 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-08-11 19:28:00 +00:00
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2020-12-04 11:21:53 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Skinning.Default;
|
2020-08-11 19:28:00 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|
|
|
{
|
|
|
|
public class TestSceneOsuModSpunOut : OsuModTestScene
|
|
|
|
{
|
2020-08-11 19:55:50 +00:00
|
|
|
protected override bool AllowFail => true;
|
|
|
|
|
2020-08-11 19:28:00 +00:00
|
|
|
[Test]
|
|
|
|
public void TestSpinnerAutoCompleted() => CreateModTest(new ModTestData
|
|
|
|
{
|
|
|
|
Mod = new OsuModSpunOut(),
|
|
|
|
Autoplay = false,
|
2020-08-11 19:55:50 +00:00
|
|
|
Beatmap = singleSpinnerBeatmap,
|
2020-11-13 14:03:44 +00:00
|
|
|
PassCondition = () => Player.ChildrenOfType<DrawableSpinner>().SingleOrDefault()?.Progress >= 1
|
2020-08-11 19:55:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
[TestCase(null)]
|
|
|
|
[TestCase(typeof(OsuModDoubleTime))]
|
|
|
|
[TestCase(typeof(OsuModHalfTime))]
|
|
|
|
public void TestSpinRateUnaffectedByMods(Type additionalModType)
|
|
|
|
{
|
|
|
|
var mods = new List<Mod> { new OsuModSpunOut() };
|
|
|
|
if (additionalModType != null)
|
|
|
|
mods.Add((Mod)Activator.CreateInstance(additionalModType));
|
|
|
|
|
|
|
|
CreateModTest(new ModTestData
|
2020-08-11 19:28:00 +00:00
|
|
|
{
|
2020-08-11 19:55:50 +00:00
|
|
|
Mods = mods,
|
|
|
|
Autoplay = false,
|
|
|
|
Beatmap = singleSpinnerBeatmap,
|
2020-11-13 14:03:44 +00:00
|
|
|
PassCondition = () =>
|
|
|
|
{
|
2021-03-26 10:09:44 +00:00
|
|
|
var counter = Player.ChildrenOfType<SpinnerSpmCalculator>().SingleOrDefault();
|
|
|
|
return counter != null && Precision.AlmostEquals(counter.Result.Value, 286, 1);
|
2020-11-13 14:03:44 +00:00
|
|
|
}
|
2020-08-11 19:55:50 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private Beatmap singleSpinnerBeatmap => new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Spinner
|
2020-08-11 19:28:00 +00:00
|
|
|
{
|
2020-08-11 19:55:50 +00:00
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
StartTime = 500,
|
|
|
|
Duration = 2000
|
2020-08-11 19:28:00 +00:00
|
|
|
}
|
2020-08-11 19:55:50 +00:00
|
|
|
}
|
|
|
|
};
|
2020-08-11 19:28:00 +00:00
|
|
|
}
|
|
|
|
}
|