Skip to content

Commit

Permalink
Fix flaky editor beatmap creation test
Browse files Browse the repository at this point in the history
As seen in
https://github.com/ppy/osu/actions/runs/12289146465/job/34294167417#step:5:1588
or
https://github.com/ppy/osu/actions/runs/12310133160/job/34358241666#step:5:53.

Exception messages hint pretty strongly at this being a threading issue
and there does seem to be a rather frivolous lack of waiting for
`CreateNewDifficulty()` to do its thing, so I'm thinking maybe this will
help.
  • Loading branch information
bdach committed Dec 13, 2024
1 parent ae10301 commit fdc41ac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,19 @@ public void TestCreateNewDifficulty([Values] bool sameRuleset)
[Test]
public void TestCreateNewDifficultyWithScrollSpeed_SameRuleset()
{
string firstDifficultyName = Guid.NewGuid().ToString();
string previousDifficultyName = null!;

AddStep("set unique difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = previousDifficultyName = Guid.NewGuid().ToString());
AddStep("save beatmap", () => Editor.Save());
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new ManiaRuleset().RulesetInfo));

AddStep("set unique difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = firstDifficultyName);
AddUntilStep("wait for created", () =>
{
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
return difficultyName != null && difficultyName != previousDifficultyName;
});

AddStep("set unique difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = previousDifficultyName = Guid.NewGuid().ToString());
AddStep("add timing point", () => EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }));
AddStep("add effect points", () =>
{
Expand All @@ -229,7 +236,7 @@ public void TestCreateNewDifficultyWithScrollSpeed_SameRuleset()
AddUntilStep("wait for created", () =>
{
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
return difficultyName != null && difficultyName != firstDifficultyName;
return difficultyName != null && difficultyName != previousDifficultyName;
});

AddAssert("created difficulty has timing point", () =>
Expand Down

0 comments on commit fdc41ac

Please sign in to comment.