1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 06:12:58 +08:00

Fix test failures

The issue was the ArchiveModelManager change; the test local change is
just there because it makes more sense to run for every test in that
scene.
This commit is contained in:
Dean Herbert 2020-09-25 18:40:20 +09:00
parent 204024c76e
commit 8b255f4579
2 changed files with 9 additions and 7 deletions

View File

@ -27,15 +27,15 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("set dummy", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)); AddStep("set dummy", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null));
base.SetUpSteps(); base.SetUpSteps();
// if we save a beatmap with a hash collision, things fall over.
// probably needs a more solid resolution in the future but this will do for now.
AddStep("make new beatmap unique", () => EditorBeatmap.Metadata.Title = Guid.NewGuid().ToString());
} }
[Test] [Test]
public void TestCreateNewBeatmap() public void TestCreateNewBeatmap()
{ {
// if we save a beatmap with a hash collision, things fall over.
// probably needs a more solid resolution in the future but this will do for now.
AddStep("make new beatmap unique", () => EditorBeatmap.Metadata.Title = Guid.NewGuid().ToString());
AddStep("save beatmap", () => Editor.Save()); AddStep("save beatmap", () => Editor.Save());
AddAssert("new beatmap persisted", () => EditorBeatmap.BeatmapInfo.ID > 0); AddAssert("new beatmap persisted", () => EditorBeatmap.BeatmapInfo.ID > 0);
} }

View File

@ -427,11 +427,13 @@ namespace osu.Game.Database
{ {
// Dereference the existing file info, since the file model will be removed. // Dereference the existing file info, since the file model will be removed.
if (file.FileInfo != null) if (file.FileInfo != null)
{
Files.Dereference(file.FileInfo); Files.Dereference(file.FileInfo);
// This shouldn't be required, but here for safety in case the provided TModel is not being change tracked // This shouldn't be required, but here for safety in case the provided TModel is not being change tracked
// Definitely can be removed once we rework the database backend. // Definitely can be removed once we rework the database backend.
usage.Context.Set<TFileModel>().Remove(file); usage.Context.Set<TFileModel>().Remove(file);
}
model.Files.Remove(file); model.Files.Remove(file);
} }