mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix exception when adding duplicate items
This commit is contained in:
@ -126,6 +126,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("playlist has 1 item", () => Room.Playlist.Count == 1);
|
AddAssert("playlist has 1 item", () => Room.Playlist.Count == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAddSameItemMultipleTimes()
|
||||||
|
{
|
||||||
|
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||||
|
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||||
|
AddAssert("playlist has 2 items", () => Room.Playlist.Count == 2);
|
||||||
|
}
|
||||||
|
|
||||||
private class TestMatchSongSelect : MatchSongSelect
|
private class TestMatchSongSelect : MatchSongSelect
|
||||||
{
|
{
|
||||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -53,6 +54,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
PlaylistItem item = new PlaylistItem
|
PlaylistItem item = new PlaylistItem
|
||||||
{
|
{
|
||||||
|
ID = (Playlist.LastOrDefault()?.ID + 1) ?? 0,
|
||||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
||||||
Ruleset = { Value = Ruleset.Value }
|
Ruleset = { Value = Ruleset.Value }
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user