mirror of
https://github.com/ppy/osu
synced 2024-12-16 11:56:31 +00:00
Merge pull request #7876 from smoogipoo/fix-playlist-id
Fix playlist items added with the wrong IDs
This commit is contained in:
commit
cf973f7730
@ -134,6 +134,22 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("playlist has 2 items", () => Room.Playlist.Count == 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddItemAfterRearrangement()
|
||||
{
|
||||
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||
AddStep("rearrange", () =>
|
||||
{
|
||||
var item = Room.Playlist[0];
|
||||
Room.Playlist.RemoveAt(0);
|
||||
Room.Playlist.Add(item);
|
||||
});
|
||||
|
||||
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||
AddAssert("new item has id 2", () => Room.Playlist.Last().ID == 2);
|
||||
}
|
||||
|
||||
private class TestMatchSongSelect : MatchSongSelect
|
||||
{
|
||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
PlaylistItem item = new PlaylistItem
|
||||
{
|
||||
ID = (Playlist.LastOrDefault()?.ID + 1) ?? 0,
|
||||
ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1
|
||||
};
|
||||
|
||||
populateItemFromCurrent(item);
|
||||
|
Loading…
Reference in New Issue
Block a user