1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Fix delete button test failures

Can be tested by adding a Thread.Sleep() in
DrawableRoomPlaylistItem.load().
This commit is contained in:
Dan Balasescu 2021-12-22 09:55:16 +09:00
parent 4ce61d4260
commit ee64ab6383

View File

@ -110,6 +110,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("finish current item", () => Client.FinishCurrentItem());
AddUntilStep("wait for next item to be selected", () => Client.Room?.Settings.PlaylistItemId == 2);
AddUntilStep("wait for two items in playlist", () => playlist.ChildrenOfType<DrawableRoomPlaylistItem>().Count() == 2);
assertDeleteButtonVisibility(0, false);
assertDeleteButtonVisibility(1, false);
@ -136,7 +137,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
}
private void assertDeleteButtonVisibility(int index, bool visible)
=> AddUntilStep($"delete button {index} {(visible ? "is" : "is not")} visible",
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(index).Alpha > 0) == visible);
=> AddUntilStep($"delete button {index} {(visible ? "is" : "is not")} visible", () =>
{
var button = playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAtOrDefault(index);
return (button?.Alpha > 0) == visible;
});
}
}