fix supporter icon in profile missing its background

also it doesn't show up on profiles without supporter anymore
This commit is contained in:
Aergwyn
2017-12-25 15:25:47 +01:00
parent 45e4c09cb8
commit bb4b5bebf9
6 changed files with 97 additions and 79 deletions

View File

@ -13,6 +13,8 @@ namespace osu.Game.Tests.Visual
{
public class TestCaseUserProfile : OsuTestCase
{
private readonly TestUserProfileOverlay profile;
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ProfileHeader),
@ -23,8 +25,7 @@ namespace osu.Game.Tests.Visual
public TestCaseUserProfile()
{
var profile = new UserProfileOverlay();
Add(profile);
Add(profile = new TestUserProfileOverlay());
AddStep("Show offline dummy", () => profile.ShowUser(new User
{
@ -48,6 +49,9 @@ namespace osu.Game.Tests.Visual
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
}
}, false));
checkSupporterTag(false);
AddStep("Show ppy", () => profile.ShowUser(new User
{
Username = @"peppy",
@ -55,6 +59,9 @@ namespace osu.Game.Tests.Visual
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
}));
checkSupporterTag(true);
AddStep("Show flyte", () => profile.ShowUser(new User
{
Username = @"flyte",
@ -62,8 +69,22 @@ namespace osu.Game.Tests.Visual
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}));
AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show);
}
private void checkSupporterTag(bool isSupporter)
{
AddUntilStep(() => profile.Header.User != null, "wait for load");
if(isSupporter)
AddAssert("is supporter", () => profile.Header.SupporterTag.Alpha == 1);
else
AddAssert("no supporter", () => profile.Header.SupporterTag.Alpha == 0);
}
private class TestUserProfileOverlay : UserProfileOverlay {
public new ProfileHeader Header => base.Header;
}
}
}