From 3d8b56fe57b6f5d72e25dc06370692f9ded43918 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 21:11:52 +0200 Subject: [PATCH] Fix user status related unit tests --- .../Visual/Online/TestCaseUserPanel.cs | 33 +++++++++++++------ osu.Game/Users/UserPanel.cs | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index ef91c843f2..3929fe6c50 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -12,10 +12,11 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestCaseUserPanel : OsuTestCase { + UserPanel flyte; + UserPanel peppy; + public TestCaseUserPanel() { - UserPanel flyte; - UserPanel peppy; Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -44,15 +45,27 @@ namespace osu.Game.Tests.Visual.Online }); flyte.Status.Value = new UserStatusOnline(); - peppy.Status.Value = new UserStatusSoloGame(null, null); + 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(@"editing", () => { flyte.Status.Value = new UserStatusEditing(null); }); - AddStep(@"choosing", () => { flyte.Status.Value = new UserStatusChoosingBeatmap(); }); - 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() + { + AddStep("idle", () => { flyte.Activity.Value = null; }); + AddStep("spectating", () => { flyte.Activity.Value = new UserActivitySpectating(); }); + AddStep("solo", () => { flyte.Activity.Value = new UserActivitySoloGame(null, null); }); + AddStep("choosing", () => { flyte.Activity.Value = new UserActivityChoosingBeatmap(); }); + AddStep("editing", () => { flyte.Activity.Value = new UserActivityEditing(null); }); + AddStep("modding", () => { flyte.Activity.Value = new UserActivityModding(); }); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index d5061ad423..410ade33fb 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -235,7 +235,7 @@ namespace osu.Game.Users if (status is UserStatusOnline && activity != null) { statusMessage.Text = activity.Status; - statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint); + statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); return; }