1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 05:42:58 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs

64 lines
2.2 KiB
C#
Raw Normal View History

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;
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-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" } },
2019-11-28 21:41:29 +08:00
new User { PreviousUsernames = Array.Empty<string>() },
2019-08-03 10:34:14 +08:00
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
}
}