Split out user activity from user status (#4619)

Split out user activity from user status

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert
2019-06-12 20:14:03 +09:00
committed by GitHub
15 changed files with 199 additions and 43 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Users;
@ -12,10 +13,12 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneUserPanel : OsuTestScene
{
private readonly UserPanel peppy;
public TestSceneUserPanel()
{
UserPanel flyte;
UserPanel peppy;
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
@ -44,13 +47,31 @@ namespace osu.Game.Tests.Visual.Online
});
flyte.Status.Value = new UserStatusOnline();
peppy.Status.Value = new UserStatusSoloGame();
peppy.Status.Value = null;
}
AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); });
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); });
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); });
AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); });
AddStep(@"null status", () => { flyte.Status.Value = null; });
[Test]
public void UserStatusesTests()
{
AddStep("online", () => { peppy.Status.Value = new UserStatusOnline(); });
AddStep(@"do not disturb", () => { peppy.Status.Value = new UserStatusDoNotDisturb(); });
AddStep(@"offline", () => { peppy.Status.Value = new UserStatusOffline(); });
AddStep(@"null status", () => { peppy.Status.Value = null; });
}
[Test]
public void UserActivitiesTests()
{
Bindable<UserActivity> activity = new Bindable<UserActivity>();
peppy.Activity.BindTo(activity);
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(); });
}
}
}