2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NUnit.Framework;
|
2018-04-23 20:41:51 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-04-23 20:41:51 +08:00
|
|
|
|
using osu.Game.Online.API;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
using osu.Game.Overlays.Profile;
|
2019-04-26 12:49:44 +08:00
|
|
|
|
using osu.Game.Overlays.Profile.Header.Components;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
2019-03-25 00:02:36 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public class TestSceneUserProfileOverlay : OsuTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly TestUserProfileOverlay profile;
|
2019-04-04 06:57:15 +08:00
|
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
|
private IAPIProvider api { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(ProfileHeader),
|
|
|
|
|
typeof(RankGraph),
|
|
|
|
|
typeof(LineGraph),
|
2018-12-22 23:51:24 +08:00
|
|
|
|
typeof(SectionsContainer<>),
|
|
|
|
|
typeof(SupporterIcon)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
};
|
|
|
|
|
|
2019-01-11 08:12:19 +08:00
|
|
|
|
public static readonly User TEST_USER = new User
|
|
|
|
|
{
|
|
|
|
|
Username = @"Somebody",
|
|
|
|
|
Id = 1,
|
|
|
|
|
Country = new Country { FullName = @"Alien" },
|
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
|
|
|
|
|
JoinDate = DateTimeOffset.Now.AddDays(-1),
|
|
|
|
|
LastVisit = DateTimeOffset.Now,
|
|
|
|
|
ProfileOrder = new[] { "me" },
|
|
|
|
|
Statistics = new UserStatistics
|
|
|
|
|
{
|
|
|
|
|
Ranks = new UserStatistics.UserRanks { Global = 2148, Country = 1 },
|
|
|
|
|
PP = 4567.89m,
|
|
|
|
|
Level = new UserStatistics.LevelInfo
|
|
|
|
|
{
|
|
|
|
|
Current = 727,
|
|
|
|
|
Progress = 69,
|
2019-08-04 19:35:26 +08:00
|
|
|
|
},
|
|
|
|
|
RankHistory = new User.RankHistoryData
|
|
|
|
|
{
|
|
|
|
|
Mode = @"osu",
|
|
|
|
|
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
|
|
|
|
|
},
|
2019-01-11 08:12:19 +08:00
|
|
|
|
},
|
|
|
|
|
Badges = new[]
|
|
|
|
|
{
|
|
|
|
|
new Badge
|
|
|
|
|
{
|
|
|
|
|
AwardedAt = DateTimeOffset.FromUnixTimeSeconds(1505741569),
|
|
|
|
|
Description = "Outstanding help by being a voluntary test subject.",
|
|
|
|
|
ImageUrl = "https://assets.ppy.sh/profile-badges/contributor.jpg"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Title = "osu!volunteer",
|
|
|
|
|
Colour = "ff0000",
|
|
|
|
|
Achievements = new User.UserAchievement[0],
|
|
|
|
|
};
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public TestSceneUserProfileOverlay()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Add(profile = new TestUserProfileOverlay());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2019-01-11 08:12:19 +08:00
|
|
|
|
AddStep("Show offline dummy", () => profile.ShowUser(TEST_USER, false));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
AddStep("Show null dummy", () => profile.ShowUser(new User
|
|
|
|
|
{
|
|
|
|
|
Username = @"Null",
|
|
|
|
|
Id = 1,
|
|
|
|
|
}, false));
|
|
|
|
|
|
|
|
|
|
AddStep("Show ppy", () => profile.ShowUser(new User
|
|
|
|
|
{
|
|
|
|
|
Username = @"peppy",
|
|
|
|
|
Id = 2,
|
2018-04-23 20:41:51 +08:00
|
|
|
|
IsSupporter = true,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
|
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
|
2018-04-23 20:41:51 +08:00
|
|
|
|
}, api.IsLoggedIn));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
AddStep("Show flyte", () => profile.ShowUser(new User
|
|
|
|
|
{
|
|
|
|
|
Username = @"flyte",
|
|
|
|
|
Id = 3103765,
|
|
|
|
|
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
|
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
2018-04-23 20:41:51 +08:00
|
|
|
|
}, api.IsLoggedIn));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
AddStep("Hide", profile.Hide);
|
|
|
|
|
AddStep("Show without reload", profile.Show);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class TestUserProfileOverlay : UserProfileOverlay
|
|
|
|
|
{
|
|
|
|
|
public new ProfileHeader Header => base.Header;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|