1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:47:25 +08:00

Fix test failures

This commit is contained in:
Dan Balasescu 2021-12-09 04:20:23 +09:00
parent 23332995d1
commit aec36adf6c

View File

@ -136,7 +136,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("import beatmap", () => manager.Import(beatmap.BeatmapSet).Wait()); AddStep("import beatmap", () => manager.Import(beatmap.BeatmapSet).Wait());
createPlaylist(beatmap); createPlaylistWithBeatmaps(beatmap);
assertDownloadButtonVisible(false); assertDownloadButtonVisible(false);
@ -159,7 +159,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
var byChecksum = CreateAPIBeatmap(); var byChecksum = CreateAPIBeatmap();
byChecksum.Checksum = "1337"; // Some random checksum that does not exist locally. byChecksum.Checksum = "1337"; // Some random checksum that does not exist locally.
createPlaylist(byOnlineId, byChecksum); createPlaylistWithBeatmaps(byOnlineId, byChecksum);
AddAssert("download buttons shown", () => playlist.ChildrenOfType<BeatmapDownloadButton>().All(d => d.IsPresent)); AddAssert("download buttons shown", () => playlist.ChildrenOfType<BeatmapDownloadButton>().All(d => d.IsPresent));
} }
@ -173,7 +173,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
beatmap.BeatmapSet.HasExplicitContent = true; beatmap.BeatmapSet.HasExplicitContent = true;
createPlaylist(beatmap); createPlaylistWithBeatmaps(beatmap);
} }
[Test] [Test]
@ -246,7 +246,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
=> AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible", => AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible",
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(2 + index * 2).Alpha > 0) == visible); () => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(2 + index * 2).Alpha > 0) == visible);
private void createPlaylist(Action<TestPlaylist> setupPlaylist) private void createPlaylist(Action<TestPlaylist> setupPlaylist = null)
{ {
AddStep("create playlist", () => AddStep("create playlist", () =>
{ {
@ -257,6 +257,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
Size = new Vector2(500, 300) Size = new Vector2(500, 300)
}; };
setupPlaylist?.Invoke(playlist);
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
playlist.Items.Add(new PlaylistItem playlist.Items.Add(new PlaylistItem
@ -292,7 +294,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded)); AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded));
} }
private void createPlaylist(params IBeatmapInfo[] beatmaps) private void createPlaylistWithBeatmaps(params IBeatmapInfo[] beatmaps)
{ {
AddStep("create playlist", () => AddStep("create playlist", () =>
{ {