mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Fix beatmap leaderboard test failure
Because the online info reset (which includes online ID reset) was happening after encoding, `TestSceneBeatmapLeaderboard.TestLocalScoresDisplayOnBeatmapEdit()` started failing, as the hash no longer matched expectations after the first save of the map.
This commit is contained in:
parent
1fb4c814f4
commit
436ebdcfcb
@ -415,6 +415,13 @@ namespace osu.Game.Beatmaps
|
|||||||
// All changes to metadata are made in the provided beatmapInfo, so this should be copied to the `IBeatmap` before encoding.
|
// All changes to metadata are made in the provided beatmapInfo, so this should be copied to the `IBeatmap` before encoding.
|
||||||
beatmapContent.BeatmapInfo = beatmapInfo;
|
beatmapContent.BeatmapInfo = beatmapInfo;
|
||||||
|
|
||||||
|
// Since now this is a locally-modified beatmap, we also set all relevant flags to indicate this.
|
||||||
|
// Importantly, the `ResetOnlineInfo()` call must happen before encoding, as online ID is encoded into the `.osu` file,
|
||||||
|
// which influences the beatmap checksums.
|
||||||
|
beatmapInfo.LastLocalUpdate = DateTimeOffset.Now;
|
||||||
|
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||||
|
beatmapInfo.ResetOnlineInfo();
|
||||||
|
|
||||||
using (var stream = new MemoryStream())
|
using (var stream = new MemoryStream())
|
||||||
{
|
{
|
||||||
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
||||||
@ -438,10 +445,6 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||||
|
|
||||||
beatmapInfo.LastLocalUpdate = DateTimeOffset.Now;
|
|
||||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
|
||||||
beatmapInfo.ResetOnlineInfo();
|
|
||||||
|
|
||||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||||
|
|
||||||
updateHashAndMarkDirty(setInfo);
|
updateHashAndMarkDirty(setInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user