Adjust beatmap creation test cases to new behaviour

This commit is contained in:
Bartłomiej Dach
2022-02-16 23:13:43 +01:00
parent 8a08bb7aaf
commit e459523afe

View File

@ -269,11 +269,12 @@ namespace osu.Game.Tests.Visual.Editing
} }
[Test] [Test]
public void TestCreateNewBeatmapFailsWithBlankNamedDifficulties() public void TestCreateMultipleNewDifficultiesSucceeds()
{ {
Guid setId = Guid.Empty; Guid setId = Guid.Empty;
AddStep("retrieve set ID", () => setId = EditorBeatmap.BeatmapInfo.BeatmapSet!.ID); AddStep("retrieve set ID", () => setId = EditorBeatmap.BeatmapInfo.BeatmapSet!.ID);
AddStep("set difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = "New Difficulty");
AddStep("save beatmap", () => Editor.Save()); AddStep("save beatmap", () => Editor.Save());
AddAssert("new beatmap persisted", () => AddAssert("new beatmap persisted", () =>
{ {
@ -282,15 +283,24 @@ namespace osu.Game.Tests.Visual.Editing
}); });
AddStep("try to create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo)); AddStep("try to create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo));
AddAssert("beatmap set unchanged", () => AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog.PerformOkAction());
AddUntilStep("wait for created", () =>
{
string difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
return difficultyName != null && difficultyName != "New Difficulty";
});
AddAssert("new difficulty has correct name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "New Difficulty (1)");
AddAssert("new difficulty persisted", () =>
{ {
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId); var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
return set != null && set.PerformRead(s => s.Beatmaps.Count == 1 && s.Files.Count == 1); return set != null && set.PerformRead(s => s.Beatmaps.Count == 2 && s.Files.Count == 2);
}); });
} }
[Test] [Test]
public void TestCreateNewBeatmapFailsWithSameNamedDifficulties([Values] bool sameRuleset) public void TestSavingBeatmapFailsWithSameNamedDifficulties([Values] bool sameRuleset)
{ {
Guid setId = Guid.Empty; Guid setId = Guid.Empty;
const string duplicate_difficulty_name = "duplicate"; const string duplicate_difficulty_name = "duplicate";