1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:47:26 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs

56 lines
1.8 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2022-06-17 15:37:17 +08:00
#nullable disable
using System.Collections.Generic;
2020-03-03 23:08:51 +08:00
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
2020-03-16 14:42:21 +08:00
using osu.Game.Overlays.Dashboard.Friends;
namespace osu.Game.Tests.Visual.UserInterface
{
2022-11-24 13:32:20 +08:00
public partial class TestSceneFriendsOnlineStatusControl : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
2020-03-23 09:47:27 +08:00
private FriendOnlineStreamControl control;
[SetUp]
2020-03-23 09:47:27 +08:00
public void SetUp() => Schedule(() => Child = control = new FriendOnlineStreamControl
{
2020-03-04 05:15:10 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
[Test]
public void Populate()
{
AddStep("Populate", () => control.Populate(new List<APIUser>
{
new APIUser
2020-03-03 23:08:51 +08:00
{
IsOnline = true
},
new APIUser
2020-03-03 23:08:51 +08:00
{
IsOnline = false
},
new APIUser
2020-03-03 23:08:51 +08:00
{
IsOnline = false
}
}));
2020-03-03 23:08:51 +08:00
2020-03-23 09:47:27 +08:00
AddAssert("3 users", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.All)?.Count == 3);
AddAssert("1 online user", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.Online)?.Count == 1);
AddAssert("2 offline users", () => control.Items.FirstOrDefault(item => item.Status == OnlineStatus.Offline)?.Count == 2);
}
}
}