mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:12:56 +08:00
Merge pull request #19469 from frenzibyte/fix-dodgy-tests
Fix potential nullref in `TestSceneAutoplay` check steps method
This commit is contained in:
commit
ecf7cc77dd
@ -31,20 +31,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
protected override void AddCheckSteps()
|
protected override void AddCheckSteps()
|
||||||
{
|
{
|
||||||
// It doesn't matter which ruleset is used - this beatmap is only used for reference.
|
// we only want this beatmap for time reference.
|
||||||
var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
var referenceBeatmap = CreateBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
|
||||||
AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0);
|
AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0);
|
||||||
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2));
|
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2));
|
||||||
|
|
||||||
seekTo(beatmap.Beatmap.Breaks[0].StartTime);
|
seekTo(referenceBeatmap.Breaks[0].StartTime);
|
||||||
AddAssert("keys not counting", () => !Player.HUDOverlay.KeyCounter.IsCounting);
|
AddAssert("keys not counting", () => !Player.HUDOverlay.KeyCounter.IsCounting);
|
||||||
AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType<BreakInfo>().Single().AccuracyDisplay.Current.Value == 1);
|
AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType<BreakInfo>().Single().AccuracyDisplay.Current.Value == 1);
|
||||||
|
|
||||||
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
|
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
|
||||||
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
|
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
|
||||||
|
|
||||||
seekTo(beatmap.Beatmap.HitObjects[^1].GetEndTime());
|
seekTo(referenceBeatmap.HitObjects[^1].GetEndTime());
|
||||||
AddUntilStep("results displayed", () => getResultsScreen()?.IsLoaded == true);
|
AddUntilStep("results displayed", () => getResultsScreen()?.IsLoaded == true);
|
||||||
|
|
||||||
AddAssert("score has combo", () => getResultsScreen().Score.Combo > 100);
|
AddAssert("score has combo", () => getResultsScreen().Score.Combo > 100);
|
||||||
|
@ -263,7 +263,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTest(IBeatmap beatmap, Action<TestDrawableScrollingRuleset> overrideAction = null) => AddStep("create test", () =>
|
private void createTest(IBeatmap beatmap, Action<TestDrawableScrollingRuleset> overrideAction = null)
|
||||||
|
{
|
||||||
|
AddStep("create test", () =>
|
||||||
{
|
{
|
||||||
var ruleset = new TestScrollingRuleset();
|
var ruleset = new TestScrollingRuleset();
|
||||||
|
|
||||||
@ -284,6 +286,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Child = drawableRuleset
|
Child = drawableRuleset
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#region Ruleset
|
#region Ruleset
|
||||||
|
|
||||||
|
@ -158,7 +158,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("clean up", () => drawableRuleset.NewResult -= onNewResult);
|
AddStep("clean up", () => drawableRuleset.NewResult -= onNewResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTest(IBeatmap beatmap, int poolSize, Func<IFrameBasedClock> createClock = null) => AddStep("create test", () =>
|
private void createTest(IBeatmap beatmap, int poolSize, Func<IFrameBasedClock> createClock = null)
|
||||||
|
{
|
||||||
|
AddStep("create test", () =>
|
||||||
{
|
{
|
||||||
var ruleset = new TestPoolingRuleset();
|
var ruleset = new TestPoolingRuleset();
|
||||||
|
|
||||||
@ -173,6 +175,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Child = drawableRuleset
|
Child = drawableRuleset
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#region Ruleset
|
#region Ruleset
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user