mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +08:00
Merge pull request #24067 from bdach/fix-difficulties-not-deleting-from-db
Fix delete difficulty flow not actually deleting the difficulty from realm
This commit is contained in:
commit
bc26d52dbd
@ -72,9 +72,13 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||
AddStep("confirm", () => InputManager.Key(Key.Number1));
|
||||
|
||||
AddAssert($"difficulty {i} is deleted", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
|
||||
AddAssert("count decreased by one", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
|
||||
AddAssert($"difficulty {i} is unattached from set",
|
||||
() => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
|
||||
AddAssert("beatmap set difficulty count decreased by one",
|
||||
() => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
|
||||
AddAssert("set hash changed", () => Beatmap.Value.BeatmapSetInfo.Hash, () => Is.Not.EqualTo(beatmapSetHashBefore));
|
||||
AddAssert($"difficulty {i} is deleted from realm",
|
||||
() => Realm.Run(r => r.Find<BeatmapInfo>(deletedDifficultyID)), () => Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +339,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
DeleteFile(setInfo, beatmapInfo.File);
|
||||
setInfo.Beatmaps.Remove(beatmapInfo);
|
||||
r.Remove(beatmapInfo.Metadata);
|
||||
r.Remove(beatmapInfo);
|
||||
|
||||
updateHashAndMarkDirty(setInfo);
|
||||
workingBeatmapCache.Invalidate(setInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user