mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add failing test case
This commit is contained in:
@ -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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -13,6 +14,7 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -183,14 +185,41 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
assertItemInHistoryListStep(2, 0);
|
assertItemInHistoryListStep(2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestInsertedItemDoesNotRefreshAllOthers()
|
||||||
|
{
|
||||||
|
AddStep("change to round robin queue mode", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { QueueMode = QueueMode.AllPlayersRoundRobin }).WaitSafely());
|
||||||
|
|
||||||
|
// Add a few items for the local user.
|
||||||
|
addItemStep();
|
||||||
|
addItemStep();
|
||||||
|
addItemStep();
|
||||||
|
addItemStep();
|
||||||
|
addItemStep();
|
||||||
|
|
||||||
|
DrawableRoomPlaylistItem[] drawableItems = null;
|
||||||
|
AddStep("get drawable items", () => drawableItems = this.ChildrenOfType<DrawableRoomPlaylistItem>().ToArray());
|
||||||
|
|
||||||
|
// Add 1 item for another user.
|
||||||
|
AddStep("join second user", () => MultiplayerClient.AddUser(new APIUser { Id = 10 }));
|
||||||
|
addItemStep(userId: 10);
|
||||||
|
|
||||||
|
// New item inserted towards the top of the list.
|
||||||
|
assertItemInQueueListStep(7, 1);
|
||||||
|
AddAssert("all previous playlist items remained", () => drawableItems.All(this.ChildrenOfType<DrawableRoomPlaylistItem>().Contains));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a step to create a new playlist item.
|
/// Adds a step to create a new playlist item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void addItemStep(bool expired = false) => AddStep("add item", () => MultiplayerClient.AddPlaylistItem(new MultiplayerPlaylistItem(new PlaylistItem(importedBeatmap)
|
private void addItemStep(bool expired = false, int? userId = null) => AddStep("add item", () =>
|
||||||
{
|
{
|
||||||
Expired = expired,
|
MultiplayerClient.AddUserPlaylistItem(userId ?? API.LocalUser.Value.OnlineID, new MultiplayerPlaylistItem(new PlaylistItem(importedBeatmap)
|
||||||
PlayedAt = DateTimeOffset.Now
|
{
|
||||||
})));
|
Expired = expired,
|
||||||
|
PlayedAt = DateTimeOffset.Now
|
||||||
|
})).WaitSafely();
|
||||||
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asserts the position of a given playlist item in the queue list.
|
/// Asserts the position of a given playlist item in the queue list.
|
||||||
|
Reference in New Issue
Block a user