1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

add queue tab count test

This commit is contained in:
hwabis 2022-03-20 16:24:41 -04:00
parent e1d22e58bf
commit 8fbdd06895
2 changed files with 32 additions and 1 deletions

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets;
@ -129,6 +130,25 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("item 1 not in lists", () => !inHistoryList(0) && !inQueueList(0));
}
[Test]
public void TestTabQueueListCount()
{
assertQueueTabCount(1);
addItemStep();
assertQueueTabCount(2);
addItemStep();
assertQueueTabCount(3);
AddStep("finish current item", () => MultiplayerClient.FinishCurrentItem().WaitSafely());
assertQueueTabCount(2);
AddStep("leave room", () => RoomManager.PartRoom());
AddUntilStep("wait for room part", () => !RoomJoined);
assertQueueTabCount(0);
}
[Ignore("Expired items are initially removed from the room.")]
[Test]
public void TestJoinRoomWithMixedItemsAddedInCorrectLists()
@ -213,6 +233,17 @@ namespace osu.Game.Tests.Visual.Multiplayer
});
}
private void assertQueueTabCount(int count)
{
string queueTabText = count > 0 ? $"Queue ({count})" : "Queue";
AddUntilStep($"Queue tab shows \"{queueTabText}\"", () =>
{
return this.ChildrenOfType<OsuTabControl<MultiplayerPlaylistDisplayMode>.OsuTabItem>()
.First()
.Text.Text.Equals(queueTabText);
});
}
private void changeDisplayModeStep(MultiplayerPlaylistDisplayMode mode) => AddStep($"change list to {mode}", () => list.DisplayMode.Value = mode);
private bool inQueueList(int playlistItemId)

View File

@ -98,7 +98,7 @@ namespace osu.Game.Graphics.UserInterface
public class OsuTabItem : TabItem<T>, IHasAccentColour
{
protected readonly SpriteText Text;
public readonly SpriteText Text;
protected readonly Box Bar;
private Color4 accentColour;