2019-08-01 18:26:59 +00: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 05:09:10 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2019-08-01 18:26:59 +00:00
|
|
|
|
using NUnit.Framework;
|
2019-08-03 01:45:41 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-08-01 18:26:59 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
2019-08-03 01:45:41 +00:00
|
|
|
|
using osu.Game.Online.API;
|
|
|
|
|
using osu.Game.Online.API.Requests;
|
2019-08-13 05:07:40 +00:00
|
|
|
|
using osu.Game.Overlays.Profile.Header.Components;
|
2019-08-01 18:26:59 +00:00
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-08-13 05:09:10 +00:00
|
|
|
|
public class TestSceneUserProfilePreviousUsernames : OsuTestScene
|
2019-08-01 18:26:59 +00:00
|
|
|
|
{
|
2019-08-13 05:09:10 +00:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(PreviousUsernames)
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-03 01:45:41 +00:00
|
|
|
|
[Resolved]
|
|
|
|
|
private IAPIProvider api { get; set; }
|
|
|
|
|
|
|
|
|
|
private readonly Bindable<User> user = new Bindable<User>();
|
|
|
|
|
|
2019-08-13 05:09:10 +00:00
|
|
|
|
public TestSceneUserProfilePreviousUsernames()
|
2019-08-01 18:26:59 +00:00
|
|
|
|
{
|
2019-08-13 05:09:10 +00:00
|
|
|
|
Child = new PreviousUsernames
|
2019-08-01 18:26:59 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
User = { BindTarget = user },
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-03 02:49:01 +00:00
|
|
|
|
User[] users =
|
2019-08-03 02:34:14 +00: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" } },
|
2019-11-28 13:41:29 +00:00
|
|
|
|
new User { PreviousUsernames = Array.Empty<string>() },
|
2019-08-03 02:34:14 +00:00
|
|
|
|
null
|
|
|
|
|
};
|
2019-08-02 04:44:09 +00:00
|
|
|
|
|
2019-08-03 02:34:14 +00: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-01 18:26:59 +00:00
|
|
|
|
}
|
2019-08-03 01:45:41 +00: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-01 18:26:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|