mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Add test coverage
This commit is contained in:
parent
0229851c9c
commit
0df15b4d7a
65
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs
Normal file
65
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs
Normal file
@ -0,0 +1,65 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class TestSceneOsuModAutoplay : OsuModTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestSpmUnaffectedByRateAdjust()
|
||||
=> runSpmTest(new OsuModDaycore
|
||||
{
|
||||
SpeedChange = { Value = 0.88 }
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestSpmUnaffectedByTimeRamp()
|
||||
=> runSpmTest(new ModWindUp
|
||||
{
|
||||
InitialRate = { Value = 0.7 },
|
||||
FinalRate = { Value = 1.3 }
|
||||
});
|
||||
|
||||
private void runSpmTest(Mod mod)
|
||||
{
|
||||
SpinnerSpmCounter spmCounter = null;
|
||||
|
||||
CreateModTest(new ModTestData
|
||||
{
|
||||
Autoplay = true,
|
||||
Mod = mod,
|
||||
Beatmap = new Beatmap
|
||||
{
|
||||
HitObjects =
|
||||
{
|
||||
new Spinner
|
||||
{
|
||||
Duration = 2000,
|
||||
Position = OsuPlayfield.BASE_SIZE / 2
|
||||
}
|
||||
}
|
||||
},
|
||||
PassCondition = () => Player.ScoreProcessor.JudgedHits >= 1
|
||||
});
|
||||
|
||||
AddUntilStep("fetch SPM counter", () =>
|
||||
{
|
||||
spmCounter = this.ChildrenOfType<SpinnerSpmCounter>().SingleOrDefault();
|
||||
return spmCounter != null;
|
||||
});
|
||||
|
||||
AddUntilStep("SPM is correct", () => Precision.AlmostEquals(spmCounter.SpinsPerMinute, 477, 5));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user