2020-03-03 14:37:01 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-03-03 15:08:51 +00:00
|
|
|
|
using System.Linq;
|
2020-03-03 14:37:01 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Overlays;
|
2020-03-16 06:42:21 +00:00
|
|
|
|
using osu.Game.Overlays.Dashboard.Friends;
|
2020-03-17 05:51:54 +00:00
|
|
|
|
using osu.Game.Users;
|
2020-03-03 14:37:01 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public class TestSceneFriendsOnlineStatusControl : OsuTestScene
|
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
2020-03-23 01:47:27 +00:00
|
|
|
|
typeof(FriendOnlineStreamControl),
|
2020-03-03 14:37:01 +00:00
|
|
|
|
typeof(FriendsOnlineStatusItem),
|
2020-03-04 20:08:58 +00:00
|
|
|
|
typeof(OverlayStreamControl<>),
|
|
|
|
|
typeof(OverlayStreamItem<>),
|
2020-03-23 01:47:27 +00:00
|
|
|
|
typeof(FriendStream)
|
2020-03-03 14:37:01 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[Cached]
|
|
|
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
|
|
|
|
|
2020-03-23 01:47:27 +00:00
|
|
|
|
private FriendOnlineStreamControl control;
|
2020-03-03 14:37:01 +00:00
|
|
|
|
|
|
|
|
|
[SetUp]
|
2020-03-23 01:47:27 +00:00
|
|
|
|
public void SetUp() => Schedule(() => Child = control = new FriendOnlineStreamControl
|
2020-03-03 14:37:01 +00:00
|
|
|
|
{
|
2020-03-03 21:15:10 +00:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2020-03-03 14:37:01 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Populate()
|
|
|
|
|
{
|
2020-03-17 05:51:54 +00:00
|
|
|
|
AddStep("Populate", () => control.Populate(new List<User>
|
2020-03-03 14:37:01 +00:00
|
|
|
|
{
|
2020-03-17 05:51:54 +00:00
|
|
|
|
new User
|
2020-03-03 15:08:51 +00:00
|
|
|
|
{
|
|
|
|
|
IsOnline = true
|
|
|
|
|
},
|
2020-03-17 05:51:54 +00:00
|
|
|
|
new User
|
2020-03-03 15:08:51 +00:00
|
|
|
|
{
|
|
|
|
|
IsOnline = false
|
|
|
|
|
},
|
2020-03-17 05:51:54 +00:00
|
|
|
|
new User
|
2020-03-03 15:08:51 +00:00
|
|
|
|
{
|
|
|
|
|
IsOnline = false
|
|
|
|
|
}
|
2020-03-03 14:37:01 +00:00
|
|
|
|
}));
|
2020-03-03 15:08:51 +00:00
|
|
|
|
|
2020-03-23 01:47:27 +00: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);
|
2020-03-03 14:37:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|