Skip to content

Commit

Permalink
Merge pull request #28638 from OliBomby/beat-divisor
Browse files Browse the repository at this point in the history
Fix editor not loading arbitrary beat divisors
  • Loading branch information
bdach authored Jun 27, 2024
2 parents 76a1f19 + 772a68c commit e357441
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,20 @@ public void TestExitWithoutSaveFromExistingBeatmap()
AddUntilStep("Wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
AddAssert("Tags reverted correctly", () => Game.Beatmap.Value.BeatmapInfo.Metadata.Tags == tags_to_save);
}

[Test]
public void TestBeatDivisor()
{
AddStep("Set custom beat divisor", () => Editor.Dependencies.Get<BindableBeatDivisor>().SetArbitraryDivisor(7));

SaveEditor();
AddAssert("Hash updated", () => !string.IsNullOrEmpty(EditorBeatmap.BeatmapInfo.BeatmapSet?.Hash));
AddAssert("Beatmap has correct beat divisor", () => EditorBeatmap.BeatmapInfo.BeatDivisor, () => Is.EqualTo(7));

ReloadEditorToSameBeatmap();

AddAssert("Beatmap still has correct beat divisor", () => EditorBeatmap.BeatmapInfo.BeatDivisor, () => Is.EqualTo(7));
AddAssert("Correct beat divisor actually active", () => Editor.BeatDivisor, () => Is.EqualTo(7));
}
}
}
2 changes: 1 addition & 1 deletion osu.Game/Screens/Edit/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private void load(OsuConfigManager config)
dependencies.CacheAs<IEditorChangeHandler>(changeHandler);
}

beatDivisor.Value = editorBeatmap.BeatmapInfo.BeatDivisor;
beatDivisor.SetArbitraryDivisor(editorBeatmap.BeatmapInfo.BeatDivisor);
beatDivisor.BindValueChanged(divisor => editorBeatmap.BeatmapInfo.BeatDivisor = divisor.NewValue);

updateLastSavedHash();
Expand Down

0 comments on commit e357441

Please sign in to comment.