Fix UserProfile test failing when not logged in

This commit is contained in:
Dean Herbert 2018-04-23 21:41:51 +09:00
parent 1de9a63ac6
commit 9551b6914b
1 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,9 @@
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile;
using osu.Game.Overlays.Profile.Header;
@ -17,6 +19,7 @@ namespace osu.Game.Tests.Visual
public class TestCaseUserProfile : OsuTestCase
{
private readonly TestUserProfileOverlay profile;
private APIAccess api;
public override IReadOnlyList<Type> RequiredTypes => new[]
{
@ -32,6 +35,12 @@ public TestCaseUserProfile()
Add(profile = new TestUserProfileOverlay());
}
[BackgroundDependencyLoader]
private void load(APIAccess api)
{
this.api = api;
}
protected override void LoadComplete()
{
base.LoadComplete();
@ -79,9 +88,10 @@ protected override void LoadComplete()
{
Username = @"peppy",
Id = 2,
IsSupporter = true,
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
}));
}, api.IsLoggedIn));
checkSupporterTag(true);
@ -91,7 +101,7 @@ protected override void LoadComplete()
Id = 3103765,
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}));
}, api.IsLoggedIn));
AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show);