Fix issues with editor check tests

This commit is contained in:
Dean Herbert
2021-11-22 14:24:17 +09:00
parent c3df58e01c
commit 4f66e8f881
4 changed files with 8 additions and 10 deletions

View File

@ -74,7 +74,7 @@ namespace osu.Game.Tests.Editing.Checks
[Test] [Test]
public void TestMissingFile() public void TestMissingFile()
{ {
beatmap.BeatmapInfo.BeatmapSet.Files.Clear(); beatmap.BeatmapInfo.BeatmapSet?.Files.Clear();
var issues = check.Run(getContext(null)).ToList(); var issues = check.Run(getContext(null)).ToList();

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Editing.Checks
[Test] [Test]
public void TestBackgroundSetAndNotInFiles() public void TestBackgroundSetAndNotInFiles()
{ {
beatmap.BeatmapInfo.BeatmapSet.Files.Clear(); beatmap.BeatmapInfo.BeatmapSet?.Files.Clear();
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap)); var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
var issues = check.Run(context).ToList(); var issues = check.Run(context).ToList();

View File

@ -1,18 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps; using osu.Game.Models;
using osu.Game.IO;
namespace osu.Game.Tests.Editing.Checks namespace osu.Game.Tests.Editing.Checks
{ {
public static class CheckTestHelpers public static class CheckTestHelpers
{ {
public static BeatmapSetFileInfo CreateMockFile(string extension) => public static RealmNamedFileUsage CreateMockFile(string extension) =>
new BeatmapSetFileInfo new RealmNamedFileUsage(new RealmFile { Hash = "abcdef" }, $"abc123.{extension}");
{
Filename = $"abc123.{extension}",
FileInfo = new FileInfo { Hash = "abcdef" }
};
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using ManagedBass; using ManagedBass;
@ -45,6 +46,8 @@ namespace osu.Game.Tests.Editing.Checks
[Test] [Test]
public void TestDifferentExtension() public void TestDifferentExtension()
{ {
Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null);
beatmap.BeatmapInfo.BeatmapSet.Files.Clear(); beatmap.BeatmapInfo.BeatmapSet.Files.Clear();
beatmap.BeatmapInfo.BeatmapSet.Files.Add(CheckTestHelpers.CreateMockFile("jpg")); beatmap.BeatmapInfo.BeatmapSet.Files.Add(CheckTestHelpers.CreateMockFile("jpg"));