Add failing test coverage for save after safeties addition

This commit is contained in:
Bartłomiej Dach
2022-01-23 19:50:02 +01:00
parent 4f1aac9345
commit afc48d86df
3 changed files with 11 additions and 5 deletions

View File

@ -378,12 +378,16 @@ namespace osu.Game.Screens.Edit
Clipboard.Content.Value = state.ClipboardContent;
});
protected void Save()
/// <summary>
/// Saves the currently edited beatmap.
/// </summary>
/// <returns>Whether the save was successful.</returns>
protected bool Save()
{
if (!canSave)
{
notifications?.Post(new SimpleErrorNotification { Text = "Saving is not supported for this ruleset yet, sorry!" });
return;
return false;
}
try
@ -395,12 +399,13 @@ namespace osu.Game.Screens.Edit
{
// can fail e.g. due to duplicated difficulty names.
Logger.Error(ex, ex.Message);
return;
return false;
}
// no longer new after first user-triggered save.
isNewBeatmap = false;
updateLastSavedHash();
return true;
}
protected override void Update()
@ -809,7 +814,7 @@ namespace osu.Game.Screens.Edit
{
var fileMenuItems = new List<MenuItem>
{
new EditorMenuItem("Save", MenuItemType.Standard, Save)
new EditorMenuItem("Save", MenuItemType.Standard, () => Save())
};
if (RuntimeInfo.IsDesktop)