2019-08-02 02:26:59 +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.
|
|
|
|
|
|
2019-08-13 13:09:10 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2019-08-02 02:26:59 +08:00
|
|
|
|
using NUnit.Framework;
|
2019-08-03 09:45:41 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-08-02 02:26:59 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
2019-08-03 09:45:41 +08:00
|
|
|
|
using osu.Game.Online.API;
|
|
|
|
|
using osu.Game.Online.API.Requests;
|
2019-08-13 13:07:40 +08:00
|
|
|
|
using osu.Game.Overlays.Profile.Header.Components;
|
2019-08-02 02:26:59 +08:00
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-08-13 13:09:10 +08:00
|
|
|
|
public class TestSceneUserProfilePreviousUsernames : OsuTestScene
|
2019-08-02 02:26:59 +08:00
|
|
|
|
{
|
2019-08-13 13:09:10 +08:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(PreviousUsernames)
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-03 09:45:41 +08:00
|
|
|
|
[Resolved]
|
|
|
|
|
private IAPIProvider api { get; set; }
|
|
|
|
|
|
|
|
|
|
private readonly Bindable<User> user = new Bindable<User>();
|
|
|
|
|
|
2019-08-13 13:09:10 +08:00
|
|
|
|
public TestSceneUserProfilePreviousUsernames()
|
2019-08-02 02:26:59 +08:00
|
|
|
|
{
|
2019-08-13 13:09:10 +08:00
|
|
|
|
Child = new PreviousUsernames
|
2019-08-02 02:26:59 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
User = { BindTarget = user },
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-03 10:49:01 +08:00
|
|
|
|
User[] users =
|
2019-08-03 10:34:14 +08:00
|
|
|
|
{
|
|
|
|
|
new User { PreviousUsernames = new[] { "username1" } },
|
|
|
|
|
new User { PreviousUsernames = new[] { "longusername", "longerusername" } },
|
|
|
|
|
new User { PreviousUsernames = new[] { "test", "angelsim", "verylongusername" } },
|
|
|
|
|
new User { PreviousUsernames = new[] { "ihavenoidea", "howcani", "makethistext", "anylonger" } },
|
|
|
|
|
new User { PreviousUsernames = new string[0] },
|
|
|
|
|
null
|
|
|
|
|
};
|
2019-08-02 12:44:09 +08:00
|
|
|
|
|
2019-08-03 10:34:14 +08:00
|
|
|
|
AddStep("single username", () => user.Value = users[0]);
|
|
|
|
|
AddStep("two usernames", () => user.Value = users[1]);
|
|
|
|
|
AddStep("three usernames", () => user.Value = users[2]);
|
|
|
|
|
AddStep("four usernames", () => user.Value = users[3]);
|
|
|
|
|
AddStep("no username", () => user.Value = users[4]);
|
|
|
|
|
AddStep("null user", () => user.Value = users[5]);
|
2019-08-02 02:26:59 +08:00
|
|
|
|
}
|
2019-08-03 09:45:41 +08:00
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
AddStep("online user (Angelsim)", () =>
|
|
|
|
|
{
|
|
|
|
|
var request = new GetUserRequest(1777162);
|
|
|
|
|
request.Success += user => this.user.Value = user;
|
|
|
|
|
api.Queue(request);
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-08-02 02:26:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|