1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Add failing test cases

This commit is contained in:
Bartłomiej Dach 2020-08-11 21:55:50 +02:00
parent 8fe5775ecb
commit 25f59e0489

View File

@ -1,27 +1,55 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Mods; 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.Rulesets.Osu.Objects.Drawables.Pieces;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Osu.Tests.Mods namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
public class TestSceneOsuModSpunOut : OsuModTestScene public class TestSceneOsuModSpunOut : OsuModTestScene
{ {
protected override bool AllowFail => true;
[Test] [Test]
public void TestSpinnerAutoCompleted() => CreateModTest(new ModTestData public void TestSpinnerAutoCompleted() => CreateModTest(new ModTestData
{ {
Mod = new OsuModSpunOut(), Mod = new OsuModSpunOut(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = singleSpinnerBeatmap,
PassCondition = () => Player.ChildrenOfType<DrawableSpinner>().Single().Progress >= 1
});
[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
{
Mods = mods,
Autoplay = false,
Beatmap = singleSpinnerBeatmap,
PassCondition = () => Precision.AlmostEquals(Player.ChildrenOfType<SpinnerSpmCounter>().Single().SpinsPerMinute, 286, 1)
});
}
private Beatmap singleSpinnerBeatmap => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -32,8 +60,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Duration = 2000 Duration = 2000
} }
} }
}, };
PassCondition = () => Player.ChildrenOfType<DrawableSpinner>().Single().Progress >= 1
});
} }
} }