mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Add failing test coverage for save after safeties addition
This commit is contained in:
parent
4f1aac9345
commit
afc48d86df
@ -109,6 +109,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
&& set != null
|
||||
&& set.PerformRead(s => s.Beatmaps.Single().ID == beatmap.ID);
|
||||
});
|
||||
AddAssert("can save again", () => Editor.Save());
|
||||
|
||||
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo));
|
||||
AddUntilStep("wait for created", () =>
|
||||
|
@ -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)
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
public new void Redo() => base.Redo();
|
||||
|
||||
public new void Save() => base.Save();
|
||||
public new bool Save() => base.Save();
|
||||
|
||||
public new void Cut() => base.Cut();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user