mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 05:57:24 +08:00
Attempt to fix common editor test failures
See
https://github.com/ppy/osu/actions/runs/13623586844/job/38143232417?pr=32180
for one example.
Arguably the bindable usage in
[`ControlPointPart`](2365b065a4/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs (L24-L26)
)
is dangerous, but it's only dangerous in tests (because control points
aren't mutated outside the editor) so I'm willing to turn a blind eye
for now to favour async loading support.
This commit is contained in:
parent
45e0446e19
commit
a0888a7f2c
@ -171,6 +171,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != firstDifficultyName;
|
return difficultyName != null && difficultyName != firstDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("created difficulty has timing point", () =>
|
AddAssert("created difficulty has timing point", () =>
|
||||||
{
|
{
|
||||||
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
||||||
@ -215,6 +217,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != previousDifficultyName;
|
return difficultyName != null && difficultyName != previousDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddStep("set unique difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = previousDifficultyName = Guid.NewGuid().ToString());
|
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 timing point", () => EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }));
|
||||||
AddStep("add effect points", () =>
|
AddStep("add effect points", () =>
|
||||||
@ -239,6 +243,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != previousDifficultyName;
|
return difficultyName != null && difficultyName != previousDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("created difficulty has timing point", () =>
|
AddAssert("created difficulty has timing point", () =>
|
||||||
{
|
{
|
||||||
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
||||||
@ -287,6 +293,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != firstDifficultyName;
|
return difficultyName != null && difficultyName != firstDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("created difficulty has timing point", () =>
|
AddAssert("created difficulty has timing point", () =>
|
||||||
{
|
{
|
||||||
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPoints.Single();
|
||||||
@ -367,6 +375,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != originalDifficultyName;
|
return difficultyName != null && difficultyName != originalDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("created difficulty has copy suffix in name", () => EditorBeatmap.BeatmapInfo.DifficultyName == copyDifficultyName);
|
AddAssert("created difficulty has copy suffix in name", () => EditorBeatmap.BeatmapInfo.DifficultyName == copyDifficultyName);
|
||||||
AddAssert("created difficulty has timing point", () =>
|
AddAssert("created difficulty has timing point", () =>
|
||||||
{
|
{
|
||||||
@ -377,7 +387,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("approach rate correctly copied", () => EditorBeatmap.Difficulty.ApproachRate == 4);
|
AddAssert("approach rate correctly copied", () => EditorBeatmap.Difficulty.ApproachRate == 4);
|
||||||
AddAssert("combo colours correctly copied", () => EditorBeatmap.BeatmapSkin.AsNonNull().ComboColours.Count == 2);
|
AddAssert("combo colours correctly copied", () => EditorBeatmap.BeatmapSkin.AsNonNull().ComboColours.Count == 2);
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
AddAssert("status is modified", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.LocallyModified);
|
AddAssert("status is modified", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.LocallyModified);
|
||||||
|
|
||||||
AddAssert("online ID not copied", () => EditorBeatmap.BeatmapInfo.OnlineID == -1);
|
AddAssert("online ID not copied", () => EditorBeatmap.BeatmapInfo.OnlineID == -1);
|
||||||
|
|
||||||
AddStep("save beatmap", () => Editor.Save());
|
AddStep("save beatmap", () => Editor.Save());
|
||||||
@ -440,6 +452,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != originalDifficultyName;
|
return difficultyName != null && difficultyName != originalDifficultyName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddStep("save without changes", () => Editor.Save());
|
AddStep("save without changes", () => Editor.Save());
|
||||||
|
|
||||||
AddAssert("collection still points to old beatmap", () => !collection.BeatmapMD5Hashes.Contains(EditorBeatmap.BeatmapInfo.MD5Hash)
|
AddAssert("collection still points to old beatmap", () => !collection.BeatmapMD5Hashes.Contains(EditorBeatmap.BeatmapInfo.MD5Hash)
|
||||||
@ -477,6 +491,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
return difficultyName != null && difficultyName != "New Difficulty";
|
return difficultyName != null && difficultyName != "New Difficulty";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("new difficulty has correct name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "New Difficulty (1)");
|
AddAssert("new difficulty has correct name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "New Difficulty (1)");
|
||||||
AddAssert("new difficulty persisted", () =>
|
AddAssert("new difficulty persisted", () =>
|
||||||
{
|
{
|
||||||
@ -514,6 +531,10 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return difficultyName != null && difficultyName != duplicate_difficulty_name;
|
return difficultyName != null && difficultyName != duplicate_difficulty_name;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddStep("set difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = duplicate_difficulty_name);
|
AddStep("set difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = duplicate_difficulty_name);
|
||||||
AddStep("try to save beatmap", () => Editor.Save());
|
AddStep("try to save beatmap", () => Editor.Save());
|
||||||
AddAssert("beatmap set not corrupted", () =>
|
AddAssert("beatmap set not corrupted", () =>
|
||||||
@ -540,6 +561,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return set != null && set.PerformRead(s => s.Beatmaps.Count == 1 && s.Files.Count == 1);
|
return set != null && set.PerformRead(s => s.Beatmaps.Count == 1 && s.Files.Count == 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new CatchRuleset().RulesetInfo));
|
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new CatchRuleset().RulesetInfo));
|
||||||
|
|
||||||
AddUntilStep("wait for created", () =>
|
AddUntilStep("wait for created", () =>
|
||||||
@ -547,7 +570,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
return difficultyName != null && difficultyName != duplicate_difficulty_name;
|
return difficultyName != null && difficultyName != duplicate_difficulty_name;
|
||||||
});
|
});
|
||||||
AddUntilStep("wait for editor load", () => Editor.IsLoaded && DialogOverlay.IsLoaded);
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddStep("add hitobjects", () => EditorBeatmap.AddRange(new[]
|
AddStep("add hitobjects", () => EditorBeatmap.AddRange(new[]
|
||||||
{
|
{
|
||||||
@ -584,6 +608,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
return difficultyName != null && difficultyName == "New Difficulty";
|
return difficultyName != null && difficultyName == "New Difficulty";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("new difficulty persisted", () =>
|
AddAssert("new difficulty persisted", () =>
|
||||||
{
|
{
|
||||||
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
|
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
|
||||||
@ -610,6 +637,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
return difficultyName != null && difficultyName == "New Difficulty (1)";
|
return difficultyName != null && difficultyName == "New Difficulty (1)";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddAssert("new difficulty persisted", () =>
|
AddAssert("new difficulty persisted", () =>
|
||||||
{
|
{
|
||||||
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
|
var set = beatmapManager.QueryBeatmapSet(s => s.ID == setId);
|
||||||
@ -735,6 +765,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("other audio not removed", () => Beatmap.Value.BeatmapSetInfo.Files.Any(f => f.Filename == "audio (1).mp3"));
|
AddAssert("other audio not removed", () => Beatmap.Value.BeatmapSetInfo.Files.Any(f => f.Filename == "audio (1).mp3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensureEditorLoaded() => AddUntilStep("wait for editor load", () => Editor.IsLoaded && DialogOverlay.IsLoaded);
|
||||||
|
|
||||||
private void createNewDifficulty()
|
private void createNewDifficulty()
|
||||||
{
|
{
|
||||||
string? currentDifficulty = null;
|
string? currentDifficulty = null;
|
||||||
@ -748,13 +780,14 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
|
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
|
||||||
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog!.PerformOkAction());
|
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog!.PerformOkAction());
|
||||||
|
|
||||||
AddUntilStep("wait for created", () =>
|
AddUntilStep("wait for created", () =>
|
||||||
{
|
{
|
||||||
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
string? difficultyName = Editor.ChildrenOfType<EditorBeatmap>().SingleOrDefault()?.BeatmapInfo.DifficultyName;
|
||||||
return difficultyName != null && difficultyName != currentDifficulty;
|
return difficultyName != null && difficultyName != currentDifficulty;
|
||||||
});
|
});
|
||||||
|
ensureEditorLoaded();
|
||||||
|
|
||||||
AddUntilStep("wait for editor load", () => Editor.IsLoaded);
|
|
||||||
AddStep("enter setup mode", () => Editor.Mode.Value = EditorScreenMode.SongSetup);
|
AddStep("enter setup mode", () => Editor.Mode.Value = EditorScreenMode.SongSetup);
|
||||||
AddUntilStep("wait for load", () => Editor.ChildrenOfType<SetupScreen>().Any());
|
AddUntilStep("wait for load", () => Editor.ChildrenOfType<SetupScreen>().Any());
|
||||||
}
|
}
|
||||||
@ -765,7 +798,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddStep($"switch to difficulty #{index + 1}", () =>
|
AddStep($"switch to difficulty #{index + 1}", () =>
|
||||||
Editor.SwitchToDifficulty(Beatmap.Value.BeatmapSetInfo.Beatmaps.ElementAt(index)));
|
Editor.SwitchToDifficulty(Beatmap.Value.BeatmapSetInfo.Beatmaps.ElementAt(index)));
|
||||||
|
|
||||||
AddUntilStep("wait for editor load", () => Editor.IsLoaded);
|
ensureEditorLoaded();
|
||||||
AddStep("enter setup mode", () => Editor.Mode.Value = EditorScreenMode.SongSetup);
|
AddStep("enter setup mode", () => Editor.Mode.Value = EditorScreenMode.SongSetup);
|
||||||
AddUntilStep("wait for load", () => Editor.ChildrenOfType<SetupScreen>().Any());
|
AddUntilStep("wait for load", () => Editor.ChildrenOfType<SetupScreen>().Any());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user