1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:03:11 +08:00

Fix user status related unit tests

This commit is contained in:
Lucas A 2019-05-05 21:11:52 +02:00
parent 8beb2f6e90
commit 3d8b56fe57
2 changed files with 24 additions and 11 deletions

View File

@ -12,10 +12,11 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture] [TestFixture]
public class TestCaseUserPanel : OsuTestCase public class TestCaseUserPanel : OsuTestCase
{ {
UserPanel flyte;
UserPanel peppy;
public TestCaseUserPanel() public TestCaseUserPanel()
{ {
UserPanel flyte;
UserPanel peppy;
Add(new FillFlowContainer Add(new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -44,15 +45,27 @@ namespace osu.Game.Tests.Visual.Online
}); });
flyte.Status.Value = new UserStatusOnline(); flyte.Status.Value = new UserStatusOnline();
peppy.Status.Value = new UserStatusSoloGame(null, null); peppy.Status.Value = null;
}
AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); [Test]
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); public void UserStatusesTests()
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); {
AddStep(@"editing", () => { flyte.Status.Value = new UserStatusEditing(null); }); AddStep("online", () => { peppy.Status.Value = new UserStatusOnline(); });
AddStep(@"choosing", () => { flyte.Status.Value = new UserStatusChoosingBeatmap(); }); AddStep(@"do not disturb", () => { peppy.Status.Value = new UserStatusDoNotDisturb(); });
AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); AddStep(@"offline", () => { peppy.Status.Value = new UserStatusOffline(); });
AddStep(@"null status", () => { flyte.Status.Value = null; }); 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(); });
} }
} }
} }

View File

@ -235,7 +235,7 @@ namespace osu.Game.Users
if (status is UserStatusOnline && activity != null) if (status is UserStatusOnline && activity != null)
{ {
statusMessage.Text = activity.Status; statusMessage.Text = activity.Status;
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint); statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint);
return; return;
} }