1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

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

View File

@ -5,7 +5,9 @@ using System;
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 @@ namespace osu.Game.Tests.Visual
Add(profile = new TestUserProfileOverlay());
}
[BackgroundDependencyLoader]
private void load(APIAccess api)
{
this.api = api;
}
protected override void LoadComplete()
{
base.LoadComplete();
@ -79,9 +88,10 @@ namespace osu.Game.Tests.Visual
{
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 @@ namespace osu.Game.Tests.Visual
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);