mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:43:22 +08:00
Add test case covering exit block
Co-authored-by: Joseph Madamba <madamba.joehu@outlook.com>
This commit is contained in:
parent
49f5d6813e
commit
d91798271d
@ -18,6 +18,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Catch;
|
using osu.Game.Rulesets.Catch;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
@ -453,6 +454,51 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitBlockedWhenSavingBeatmapWithSameNamedDifficulties()
|
||||||
|
{
|
||||||
|
Guid setId = Guid.Empty;
|
||||||
|
const string duplicate_difficulty_name = "duplicate";
|
||||||
|
|
||||||
|
AddStep("retrieve set ID", () => setId = EditorBeatmap.BeatmapInfo.BeatmapSet!.ID);
|
||||||
|
AddStep("set difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = duplicate_difficulty_name);
|
||||||
|
AddStep("save beatmap", () => Editor.Save());
|
||||||
|
AddAssert("new beatmap persisted", () =>
|
||||||
|
{
|
||||||
|
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
|
||||||
|
return set != null && set.PerformRead(s => s.Beatmaps.Count == 1 && s.Files.Count == 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new CatchRuleset().RulesetInfo));
|
||||||
|
|
||||||
|
AddUntilStep("wait for created", () =>
|
||||||
|
{
|
||||||
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
|
return difficultyName != null && difficultyName != duplicate_difficulty_name;
|
||||||
|
});
|
||||||
|
AddUntilStep("wait for editor load", () => Editor.IsLoaded && DialogOverlay.IsLoaded);
|
||||||
|
|
||||||
|
AddStep("add hitobjects", () => EditorBeatmap.AddRange(new[]
|
||||||
|
{
|
||||||
|
new Fruit
|
||||||
|
{
|
||||||
|
StartTime = 0
|
||||||
|
},
|
||||||
|
new Fruit
|
||||||
|
{
|
||||||
|
StartTime = 1000
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("set difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = duplicate_difficulty_name);
|
||||||
|
AddUntilStep("wait for has unsaved changes", () => Editor.HasUnsavedChanges);
|
||||||
|
|
||||||
|
AddStep("exit", () => Editor.Exit());
|
||||||
|
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is PromptForSaveDialog);
|
||||||
|
AddStep("attempt to save", () => DialogOverlay.CurrentDialog.PerformOkAction());
|
||||||
|
AddAssert("editor is still current", () => Editor.IsCurrentScreen());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCreateNewDifficultyForInconvertibleRuleset()
|
public void TestCreateNewDifficultyForInconvertibleRuleset()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user