1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-24 01:02:54 +08:00

Recreate beatmap every test run in ModTestScene

This commit is contained in:
Salman Alshamrani 2024-11-21 17:48:12 -05:00
parent 23ef8fd909
commit 5dffc322af
29 changed files with 110 additions and 107 deletions

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => Player.ScoreProcessor.Combo.Value == 2, PassCondition = () => Player.ScoreProcessor.Combo.Value == 2,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => true, PassCondition = () => true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => true, PassCondition = () => true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
Mod = new CatchModRelax(), Mod = new CatchModRelax(),
Autoplay = false, Autoplay = false,
PassCondition = passCondition, PassCondition = passCondition,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Autoplay = true, Autoplay = true,
Beatmap = new ManiaBeatmap(new StageDefinition(1)) Beatmap = () => new ManiaBeatmap(new StageDefinition(1))
{ {
HitObjects = new List<ManiaHitObject> HitObjects = new List<ManiaHitObject>
{ {

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
&& Precision.AlmostEquals(Player.ScoreProcessor.Accuracy.Value, 0.9836, 0.01) && Precision.AlmostEquals(Player.ScoreProcessor.Accuracy.Value, 0.9836, 0.01)
&& Player.ScoreProcessor.TotalScore.Value == 946_049, && Player.ScoreProcessor.TotalScore.Value == 946_049,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
Difficulty = { OverallDifficulty = 10 }, Difficulty = { OverallDifficulty = 10 },
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
&& Player.ScoreProcessor.Accuracy.Value == 1 && Player.ScoreProcessor.Accuracy.Value == 1
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * doubleTime.ScoreMultiplier), && Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * doubleTime.ScoreMultiplier),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
Difficulty = { OverallDifficulty = 10 }, Difficulty = { OverallDifficulty = 10 },

View File

@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Mod = new ManiaModHidden(), Mod = new ManiaModHidden(),
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = Enumerable.Range(1, 100).Select(i => (HitObject)new Note { StartTime = 1000 + 200 * i }).ToList(), HitObjects = Enumerable.Range(1, 100).Select(i => (HitObject)new Note { StartTime = 1000 + 200 * i }).ToList(),
Breaks = { new BreakPeriod(2000, 28000) } Breaks = { new BreakPeriod(2000, 28000) }

View File

@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Mod = new ManiaModHidden(), Mod = new ManiaModHidden(),
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = Enumerable.Range(1, 100).Select(i => (HitObject)new Note { StartTime = 1000 + 200 * i }).ToList(), HitObjects = Enumerable.Range(1, 100).Select(i => (HitObject)new Note { StartTime = 1000 + 200 * i }).ToList(),
Breaks = { new BreakPeriod(2000, 28000) } Breaks = { new BreakPeriod(2000, 28000) }

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
Mod = new ManiaModPerfect(), Mod = new ManiaModPerfect(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
Mod = new ManiaModPerfect(), Mod = new ManiaModPerfect(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2, PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
Mod = new ManiaModSuddenDeath(), Mod = new ManiaModSuddenDeath(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
Mod = new ManiaModSuddenDeath(), Mod = new ManiaModSuddenDeath(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2, PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModAlternate(), Mod = new OsuModAlternate(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 4, PassCondition = () => Player.ScoreProcessor.Combo.Value == 4,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModAlternate(), Mod = new OsuModAlternate(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 1, PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 1,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModAlternate(), Mod = new OsuModAlternate(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 1, PassCondition = () => Player.ScoreProcessor.Combo.Value == 1,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModAlternate(), Mod = new OsuModAlternate(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2, PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
Breaks = Breaks =
{ {

View File

@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Autoplay = true, Autoplay = true,
Mod = mod, Mod = mod,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = HitObjects =
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
public void TestNoAdjustment() => CreateModTest(new ModTestData public void TestNoAdjustment() => CreateModTest(new ModTestData
{ {
Mod = new OsuModDifficultyAdjust(), Mod = new OsuModDifficultyAdjust(),
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
BeatmapInfo = new BeatmapInfo BeatmapInfo = new BeatmapInfo
{ {

View File

@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Player.GameplayClockContainer.CurrentTime < 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0; Player.GameplayClockContainer.CurrentTime < 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0;
return Player.GameplayState.HasPassed && !sliderDimmedBeforeStartTime; return Player.GameplayState.HasPassed && !sliderDimmedBeforeStartTime;
}, },
Beatmap = new OsuBeatmap Beatmap = () => new OsuBeatmap
{ {
HitObjects = new List<OsuHitObject> HitObjects = new List<OsuHitObject>
{ {
@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0; Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0;
return Player.GameplayState.HasPassed && sliderDimmed; return Player.GameplayState.HasPassed && sliderDimmed;
}, },
Beatmap = new OsuBeatmap Beatmap = () => new OsuBeatmap
{ {
HitObjects = new List<OsuHitObject> HitObjects = new List<OsuHitObject>
{ {
@ -153,7 +153,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0; Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0;
return Player.GameplayState.HasPassed && sliderDimmed; return Player.GameplayState.HasPassed && sliderDimmed;
}, },
Beatmap = new OsuBeatmap Beatmap = () => new OsuBeatmap
{ {
HitObjects = new List<OsuHitObject> HitObjects = new List<OsuHitObject>
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Mod = new TestOsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Mod = new TestOsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Mod = new TestOsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Mod = new OsuModHidden { OnlyFadeApproachCircles = { Value = true } }, Mod = new OsuModHidden { OnlyFadeApproachCircles = { Value = true } },
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
public void TestCorrectReflections([Values] OsuModMirror.MirrorType type, [Values] bool withStrictTracking) => CreateModTest(new ModTestData public void TestCorrectReflections([Values] OsuModMirror.MirrorType type, [Values] bool withStrictTracking) => CreateModTest(new ModTestData
{ {
Autoplay = true, Autoplay = true,
Beatmap = new OsuBeatmap Beatmap = () => new OsuBeatmap
{ {
HitObjects = HitObjects =
{ {

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => true, PassCondition = () => true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => true, PassCondition = () => true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
}, },
Autoplay = true, Autoplay = true,
PassCondition = () => true, PassCondition = () => true,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModPerfect(), Mod = new OsuModPerfect(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true), PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -55,10 +55,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
PassCondition = () => true PassCondition = () => true
}); });
private OsuBeatmap jumpBeatmap => private OsuBeatmap jumpBeatmap() =>
createHitCircleBeatmap(new[] { 100, 200, 300, 400 }, 8, 300, 2 * 300); createHitCircleBeatmap(new[] { 100, 200, 300, 400 }, 8, 300, 2 * 300);
private OsuBeatmap streamBeatmap => private OsuBeatmap streamBeatmap() =>
createHitCircleBeatmap(new[] { 10, 20, 30, 40, 50, 60, 70, 80 }, 16, 150, 4 * 150); createHitCircleBeatmap(new[] { 10, 20, 30, 40, 50, 60, 70, 80 }, 16, 150, 4 * 150);
private OsuBeatmap createHitCircleBeatmap(IEnumerable<int> spacings, int objectsPerSpacing, int interval, int beatLength) private OsuBeatmap createHitCircleBeatmap(IEnumerable<int> spacings, int objectsPerSpacing, int interval, int beatLength)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSingleTap(), Mod = new OsuModSingleTap(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 2, PassCondition = () => Player.ScoreProcessor.Combo.Value == 2,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSingleTap(), Mod = new OsuModSingleTap(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 1, PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 1,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSingleTap(), Mod = new OsuModSingleTap(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 1, PassCondition = () => Player.ScoreProcessor.Combo.Value == 1,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSingleTap(), Mod = new OsuModSingleTap(),
PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2, PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2,
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
Breaks = Breaks =
{ {

View File

@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
}); });
} }
private Beatmap singleSpinnerBeatmap => new Beatmap private Beatmap singleSpinnerBeatmap() => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{ {
Mod = new OsuModStrictTracking(), Mod = new OsuModStrictTracking(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSuddenDeath(), Mod = new OsuModSuddenDeath(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
Mod = new OsuModSuddenDeath(), Mod = new OsuModSuddenDeath(),
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true), PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
Autoplay = false, Autoplay = false,
Mod = new TestAutoMod(), Mod = new TestAutoMod(),
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } } HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
}, },
@ -47,18 +47,16 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test] [Test]
public void TestMissViaNotHitting() public void TestMissViaNotHitting()
{ {
var beatmap = new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
};
var hitWindows = new OsuHitWindows(); var hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty); hitWindows.SetDifficulty(IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY);
CreateModTest(new ModTestData CreateModTest(new ModTestData
{ {
Autoplay = false, Autoplay = false,
Beatmap = beatmap, Beatmap = () => new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
},
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset >= hitWindows.WindowFor(HitResult.Meh) && !Player.Results[0].IsHit PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset >= hitWindows.WindowFor(HitResult.Meh) && !Player.Results[0].IsHit
}); });
} }

View File

@ -31,6 +31,13 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
const double hit_time = 1; const double hit_time = 1;
CreateModTest(new ModTestData
{
Mod = new TaikoModHidden(),
Autoplay = true,
PassCondition = checkAllMaxResultJudgements(2),
Beatmap = () =>
{
var beatmap = new Beatmap<TaikoHitObject> var beatmap = new Beatmap<TaikoHitObject>
{ {
HitObjects = new List<TaikoHitObject> HitObjects = new List<TaikoHitObject>
@ -58,13 +65,8 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
}; };
beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f }); beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f });
return beatmap;
CreateModTest(new ModTestData },
{
Mod = new TaikoModHidden(),
Autoplay = true,
PassCondition = checkAllMaxResultJudgements(2),
Beatmap = beatmap,
}); });
} }
} }

View File

@ -15,7 +15,26 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
[Test] [Test]
public void TestRelax() public void TestRelax()
{ {
var beatmap = new TaikoBeatmap var beatmapForReplay = createBeatmap();
foreach (var ho in beatmapForReplay.HitObjects)
ho.ApplyDefaults(beatmapForReplay.ControlPointInfo, beatmapForReplay.Difficulty);
var replay = new TaikoAutoGenerator(beatmapForReplay).Generate();
foreach (var frame in replay.Frames.OfType<TaikoReplayFrame>().Where(r => r.Actions.Any()))
frame.Actions = [TaikoAction.LeftCentre];
CreateModTest(new ModTestData
{
Mod = new TaikoModRelax(),
Beatmap = createBeatmap,
ReplayFrames = replay.Frames,
Autoplay = false,
PassCondition = () => Player.ScoreProcessor.HasCompleted.Value && Player.ScoreProcessor.Accuracy.Value == 1,
});
TaikoBeatmap createBeatmap() => new TaikoBeatmap
{ {
HitObjects = HitObjects =
{ {
@ -25,22 +44,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
new Swell { StartTime = 1250, Duration = 500 }, new Swell { StartTime = 1250, Duration = 500 },
} }
}; };
foreach (var ho in beatmap.HitObjects)
ho.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
var replay = new TaikoAutoGenerator(beatmap).Generate();
foreach (var frame in replay.Frames.OfType<TaikoReplayFrame>().Where(r => r.Actions.Any()))
frame.Actions = [TaikoAction.LeftCentre];
CreateModTest(new ModTestData
{
Mod = new TaikoModRelax(),
Beatmap = beatmap,
ReplayFrames = replay.Frames,
Autoplay = false,
PassCondition = () => Player.ScoreProcessor.HasCompleted.Value && Player.ScoreProcessor.Accuracy.Value == 1,
});
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
Mod = new TaikoModSingleTap(), Mod = new TaikoModSingleTap(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
Mod = new TaikoModSingleTap(), Mod = new TaikoModSingleTap(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
Mod = new TaikoModSingleTap(), Mod = new TaikoModSingleTap(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
Mod = new TaikoModSingleTap(), Mod = new TaikoModSingleTap(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
Mod = new TaikoModSingleTap(), Mod = new TaikoModSingleTap(),
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
Breaks = Breaks =
{ {

View File

@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Mods
MinimumAccuracy = { Value = 0.6 } MinimumAccuracy = { Value = 0.6 }
}, },
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle
{ {
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Mods
AccuracyJudgeMode = { Value = ModAccuracyChallenge.AccuracyMode.Standard } AccuracyJudgeMode = { Value = ModAccuracyChallenge.AccuracyMode.Standard }
}, },
Autoplay = false, Autoplay = false,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle
{ {

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual
protected void CreateHitObjectTest(HitObjectTestData testData, bool shouldMiss) => CreateModTest(new ModTestData protected void CreateHitObjectTest(HitObjectTestData testData, bool shouldMiss) => CreateModTest(new ModTestData
{ {
Mod = mod, Mod = mod,
Beatmap = new Beatmap Beatmap = () => new Beatmap
{ {
BeatmapInfo = { Ruleset = CreatePlayerRuleset().RulesetInfo }, BeatmapInfo = { Ruleset = CreatePlayerRuleset().RulesetInfo },
HitObjects = { testData.HitObject } HitObjects = { testData.HitObject }

View File

@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual
base.TearDownSteps(); base.TearDownSteps();
} }
protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => CurrentTestData?.Beatmap ?? base.CreateBeatmap(ruleset); protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => CurrentTestData?.Beatmap?.Invoke() ?? base.CreateBeatmap(ruleset);
protected sealed override TestPlayer CreatePlayer(Ruleset ruleset) protected sealed override TestPlayer CreatePlayer(Ruleset ruleset)
{ {
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Visual
/// The beatmap for this test case. /// The beatmap for this test case.
/// </summary> /// </summary>
[CanBeNull] [CanBeNull]
public IBeatmap Beatmap; public Func<IBeatmap> Beatmap;
/// <summary> /// <summary>
/// The conditions that cause this test case to pass. /// The conditions that cause this test case to pass.