2021-02-08 02:25:33 +08: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.
|
|
|
|
|
2023-06-10 16:30:10 +08:00
|
|
|
using System.Collections.Generic;
|
2021-02-08 02:25:33 +08:00
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
2022-07-20 20:34:55 +08:00
|
|
|
using osu.Framework.Extensions.ObjectExtensions;
|
2021-02-08 02:25:33 +08:00
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Beatmaps;
|
2023-06-10 16:30:10 +08:00
|
|
|
using osu.Game.Configuration;
|
2021-02-08 02:25:33 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2023-06-10 16:30:10 +08:00
|
|
|
using osu.Game.Rulesets.Objects;
|
2021-02-08 02:25:33 +08:00
|
|
|
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;
|
2023-06-10 16:30:10 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
using osuTK;
|
2021-02-08 02:25:33 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|
|
|
{
|
|
|
|
public partial class TestSceneOsuModAutoplay : OsuModTestScene
|
|
|
|
{
|
2023-06-10 16:30:10 +08:00
|
|
|
protected override bool AllowFail => true;
|
|
|
|
|
2023-06-01 12:26:46 +08:00
|
|
|
[Test]
|
|
|
|
public void TestCursorPositionStoredToJudgement()
|
|
|
|
{
|
|
|
|
CreateModTest(new ModTestData
|
|
|
|
{
|
|
|
|
Autoplay = true,
|
|
|
|
PassCondition = () =>
|
|
|
|
Player.ScoreProcessor.JudgedHits >= 1
|
|
|
|
&& Player.ScoreProcessor.HitEvents.Any(e => e.Position != null)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-02-08 02:25:33 +08:00
|
|
|
[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 }
|
|
|
|
});
|
|
|
|
|
2023-10-03 17:35:01 +08:00
|
|
|
[TestCase(6.25f)]
|
|
|
|
[TestCase(20)]
|
|
|
|
public void TestPerfectScoreOnShortSliderWithRepeat(float pathLength)
|
2023-06-10 16:30:10 +08:00
|
|
|
{
|
|
|
|
AddStep("set score to standardised", () => LocalConfig.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised));
|
|
|
|
|
|
|
|
CreateModTest(new ModTestData
|
|
|
|
{
|
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 500,
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
Path = new SliderPath(new[]
|
|
|
|
{
|
|
|
|
new PathControlPoint(),
|
2023-10-03 17:35:01 +08:00
|
|
|
new PathControlPoint(new Vector2(0, pathLength))
|
2023-06-10 16:30:10 +08:00
|
|
|
}),
|
|
|
|
RepeatCount = 1,
|
2023-09-06 17:59:15 +08:00
|
|
|
SliderVelocityMultiplier = 10
|
2023-06-10 16:30:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
PassCondition = () => Player.ScoreProcessor.TotalScore.Value == 1_000_000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-02-08 02:25:33 +08:00
|
|
|
private void runSpmTest(Mod mod)
|
|
|
|
{
|
2022-07-20 20:34:55 +08:00
|
|
|
SpinnerSpmCalculator? spmCalculator = null;
|
2021-02-08 02:25:33 +08:00
|
|
|
|
|
|
|
CreateModTest(new ModTestData
|
|
|
|
{
|
|
|
|
Autoplay = true,
|
|
|
|
Mod = mod,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects =
|
|
|
|
{
|
|
|
|
new Spinner
|
|
|
|
{
|
2021-10-13 19:26:54 +08:00
|
|
|
Duration = 6000,
|
|
|
|
Position = OsuPlayfield.BASE_SIZE / 2,
|
2021-02-08 02:25:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
PassCondition = () => Player.ScoreProcessor.JudgedHits >= 1
|
|
|
|
});
|
|
|
|
|
2021-03-26 18:09:44 +08:00
|
|
|
AddUntilStep("fetch SPM calculator", () =>
|
2021-02-08 02:25:33 +08:00
|
|
|
{
|
2021-03-26 18:09:44 +08:00
|
|
|
spmCalculator = this.ChildrenOfType<SpinnerSpmCalculator>().SingleOrDefault();
|
|
|
|
return spmCalculator != null;
|
2021-02-08 02:25:33 +08:00
|
|
|
});
|
|
|
|
|
2022-07-20 20:34:55 +08:00
|
|
|
AddUntilStep("SPM is correct", () => Precision.AlmostEquals(spmCalculator.AsNonNull().Result.Value, 477, 5));
|
2021-02-08 02:25:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|