1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 09:42:54 +08:00

Rename variable to imply it is now a function

This commit is contained in:
Dean Herbert 2024-11-22 13:11:32 +09:00
parent 5dffc322af
commit 41addaae9a
No known key found for this signature in database
29 changed files with 62 additions and 61 deletions

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
CreateModTest(new ModTestData
{
Autoplay = true,
Beatmap = () => new ManiaBeatmap(new StageDefinition(1))
CreateBeatmap = () => new ManiaBeatmap(new StageDefinition(1))
{
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)
&& Player.ScoreProcessor.TotalScore.Value == 946_049,
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
Difficulty = { OverallDifficulty = 10 },
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
&& Player.ScoreProcessor.Accuracy.Value == 1
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * doubleTime.ScoreMultiplier),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
Difficulty = { OverallDifficulty = 10 },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
public void TestNoAdjustment() => CreateModTest(new ModTestData
{
Mod = new OsuModDifficultyAdjust(),
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
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;
return Player.GameplayState.HasPassed && !sliderDimmedBeforeStartTime;
},
Beatmap = () => new OsuBeatmap
CreateBeatmap = () => new OsuBeatmap
{
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;
return Player.GameplayState.HasPassed && sliderDimmed;
},
Beatmap = () => new OsuBeatmap
CreateBeatmap = () => new OsuBeatmap
{
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;
return Player.GameplayState.HasPassed && sliderDimmed;
},
Beatmap = () => new OsuBeatmap
CreateBeatmap = () => new OsuBeatmap
{
HitObjects = new List<OsuHitObject>
{

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
AngleSharpness = { Value = angleSharpness }
},
Beatmap = jumpBeatmap,
CreateBeatmap = jumpBeatmap,
Autoplay = true,
PassCondition = () => true
});
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
AngleSharpness = { Value = angleSharpness }
},
Beatmap = streamBeatmap,
CreateBeatmap = streamBeatmap,
Autoplay = true,
PassCondition = () => true
});

View File

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

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
Mod = new OsuModSpunOut(),
Autoplay = false,
Beatmap = singleSpinnerBeatmap,
CreateBeatmap = singleSpinnerBeatmap,
PassCondition = () =>
{
// Bind to the first spinner's results for further tracking.
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
Mods = mods,
Autoplay = false,
Beatmap = singleSpinnerBeatmap,
CreateBeatmap = singleSpinnerBeatmap,
PassCondition = () =>
{
var counter = Player.ChildrenOfType<SpinnerSpmCalculator>().SingleOrDefault();
@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
Mod = new OsuModSpunOut(),
Autoplay = false,
Beatmap = singleSpinnerBeatmap,
CreateBeatmap = singleSpinnerBeatmap,
PassCondition = () =>
{
// Bind to the first spinner's results for further tracking.

View File

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

View File

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

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
Autoplay = false,
Mod = new TestAutoMod(),
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
},
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Tests
CreateModTest(new ModTestData
{
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
},

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
Mod = new TaikoModHidden(),
Autoplay = true,
PassCondition = checkAllMaxResultJudgements(2),
Beatmap = () =>
CreateBeatmap = () =>
{
var beatmap = new Beatmap<TaikoHitObject>
{

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
CreateModTest(new ModTestData
{
Mod = new TaikoModRelax(),
Beatmap = createBeatmap,
CreateBeatmap = createBeatmap,
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(),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{
Mod = new TaikoModSingleTap(),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{
Mod = new TaikoModSingleTap(),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{
Mod = new TaikoModSingleTap(),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
{
Mod = new TaikoModSingleTap(),
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
Breaks =
{

View File

@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Mods
MinimumAccuracy = { Value = 0.6 }
},
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle
{
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Mods
AccuracyJudgeMode = { Value = ModAccuracyChallenge.AccuracyMode.Standard }
},
Autoplay = false,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
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
{
Mod = mod,
Beatmap = () => new Beatmap
CreateBeatmap = () => new Beatmap
{
BeatmapInfo = { Ruleset = CreatePlayerRuleset().RulesetInfo },
HitObjects = { testData.HitObject }

View File

@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual
base.TearDownSteps();
}
protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => CurrentTestData?.Beatmap?.Invoke() ?? base.CreateBeatmap(ruleset);
protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => CurrentTestData?.CreateBeatmap?.Invoke() ?? base.CreateBeatmap(ruleset);
protected sealed override TestPlayer CreatePlayer(Ruleset ruleset)
{
@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual
protected class ModTestData
{
/// <summary>
/// Whether to use a replay to simulate an auto-play. True by default.
/// Whether to use a replay to simulate an autoplay. True by default.
/// </summary>
public bool Autoplay = true;
@ -104,10 +104,11 @@ namespace osu.Game.Tests.Visual
public List<ReplayFrame> ReplayFrames;
/// <summary>
/// The beatmap for this test case.
/// A function which should create a new instance of a beatmap containing relevant
/// content to the test.
/// </summary>
[CanBeNull]
public Func<IBeatmap> Beatmap;
public Func<IBeatmap> CreateBeatmap;
/// <summary>
/// The conditions that cause this test case to pass.