Replace IWorkingBeatmap arg with BeatmapVerifierContext in checks

This simplifies passing of contextual information by enabling addition without needing to refactor lots of classes.

See next commit for example.
This commit is contained in:
Naxess
2021-05-12 02:29:18 +02:00
parent 4aeaec6ecc
commit c13b93e6f1
16 changed files with 96 additions and 47 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Checks;
@ -224,12 +225,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
private void assertOk(IBeatmap beatmap)
{
Assert.That(check.Run(beatmap, new TestWorkingBeatmap(beatmap)), Is.Empty);
var context = new BeatmapVerifierContext(new TestWorkingBeatmap(beatmap));
Assert.That(check.Run(beatmap, context), Is.Empty);
}
private void assertOffscreenCircle(IBeatmap beatmap)
{
var issues = check.Run(beatmap, new TestWorkingBeatmap(beatmap)).ToList();
var context = new BeatmapVerifierContext(new TestWorkingBeatmap(beatmap));
var issues = check.Run(beatmap, context).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenCircle);
@ -237,7 +240,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
private void assertOffscreenSlider(IBeatmap beatmap)
{
var issues = check.Run(beatmap, new TestWorkingBeatmap(beatmap)).ToList();
var context = new BeatmapVerifierContext(new TestWorkingBeatmap(beatmap));
var issues = check.Run(beatmap, context).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenSlider);