mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +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);
|
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||||
AddStep("confirm", () => InputManager.Key(Key.Number1));
|
AddStep("confirm", () => InputManager.Key(Key.Number1));
|
||||||
|
|
||||||
AddAssert($"difficulty {i} is deleted", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
|
AddAssert($"difficulty {i} is unattached from set",
|
||||||
AddAssert("count decreased by one", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
|
() => 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("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);
|
DeleteFile(setInfo, beatmapInfo.File);
|
||||||
setInfo.Beatmaps.Remove(beatmapInfo);
|
setInfo.Beatmaps.Remove(beatmapInfo);
|
||||||
|
r.Remove(beatmapInfo.Metadata);
|
||||||
|
r.Remove(beatmapInfo);
|
||||||
|
|
||||||
updateHashAndMarkDirty(setInfo);
|
updateHashAndMarkDirty(setInfo);
|
||||||
workingBeatmapCache.Invalidate(setInfo);
|
workingBeatmapCache.Invalidate(setInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user