2019-01-24 08:43:03 +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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
using NUnit.Framework;
|
2019-06-12 09:04:57 +00:00
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 09:19:50 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Users;
|
2018-11-20 07:51:59 +00:00
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-03-24 16:02:36 +00:00
|
|
|
namespace osu.Game.Tests.Visual.Online
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2019-05-14 19:37:25 +00:00
|
|
|
public class TestSceneUserPanel : OsuTestScene
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
2020-03-04 21:02:36 +00:00
|
|
|
private readonly Bindable<UserActivity> activity = new Bindable<UserActivity>();
|
2019-05-05 19:11:52 +00:00
|
|
|
|
2020-03-04 21:02:36 +00:00
|
|
|
private UserPanel peppy;
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public void SetUp() => Schedule(() =>
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
2019-06-12 06:59:52 +00:00
|
|
|
UserPanel flyte;
|
|
|
|
|
2020-03-04 21:02:36 +00:00
|
|
|
Child = new FillFlowContainer
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Spacing = new Vector2(10f),
|
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
flyte = new UserPanel(new User
|
|
|
|
{
|
|
|
|
Username = @"flyte",
|
|
|
|
Id = 3103765,
|
|
|
|
Country = new Country { FlagName = @"JP" },
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
|
|
|
}) { Width = 300 },
|
|
|
|
peppy = new UserPanel(new User
|
|
|
|
{
|
|
|
|
Username = @"peppy",
|
|
|
|
Id = 2,
|
|
|
|
Country = new Country { FlagName = @"AU" },
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
IsSupporter = true,
|
2018-12-22 15:51:24 +00:00
|
|
|
SupportLevel = 3,
|
2018-04-13 09:19:50 +00:00
|
|
|
}) { Width = 300 },
|
|
|
|
},
|
2020-03-04 21:02:36 +00:00
|
|
|
};
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
flyte.Status.Value = new UserStatusOnline();
|
2019-05-05 19:11:52 +00:00
|
|
|
peppy.Status.Value = null;
|
2020-03-04 21:02:36 +00:00
|
|
|
peppy.Activity.BindTo(activity);
|
|
|
|
});
|
2019-05-05 19:11:52 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void UserStatusesTests()
|
|
|
|
{
|
2020-03-04 21:04:49 +00:00
|
|
|
AddStep("online", () => peppy.Status.Value = new UserStatusOnline());
|
2020-03-04 21:05:08 +00:00
|
|
|
AddStep("do not disturb", () => peppy.Status.Value = new UserStatusDoNotDisturb());
|
|
|
|
AddStep("offline", () => peppy.Status.Value = new UserStatusOffline());
|
|
|
|
AddStep("null status", () => peppy.Status.Value = null);
|
2019-05-05 19:11:52 +00:00
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-05-05 19:11:52 +00:00
|
|
|
[Test]
|
|
|
|
public void UserActivitiesTests()
|
|
|
|
{
|
2020-03-04 21:04:49 +00:00
|
|
|
AddStep("idle", () => activity.Value = null);
|
|
|
|
AddStep("spectating", () => activity.Value = new UserActivity.Spectating());
|
|
|
|
AddStep("solo", () => activity.Value = new UserActivity.SoloGame(null, null));
|
|
|
|
AddStep("choosing", () => activity.Value = new UserActivity.ChoosingBeatmap());
|
|
|
|
AddStep("editing", () => activity.Value = new UserActivity.Editing(null));
|
|
|
|
AddStep("modding", () => activity.Value = new UserActivity.Modding());
|
2018-04-13 09:19:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|