mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 23:12:55 +08:00
Merge branch 'master' into fix-skin-layout-editor-crash
This commit is contained in:
commit
7a1be99999
@ -3,11 +3,7 @@
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Profile.Header.Components;
|
||||
using osu.Game.Users;
|
||||
|
||||
@ -16,48 +12,50 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[TestFixture]
|
||||
public class TestSceneUserProfilePreviousUsernames : OsuTestScene
|
||||
{
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
private PreviousUsernames container;
|
||||
|
||||
private readonly Bindable<User> user = new Bindable<User>();
|
||||
|
||||
public TestSceneUserProfilePreviousUsernames()
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
Child = new PreviousUsernames
|
||||
Child = container = new PreviousUsernames
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
User = { BindTarget = user },
|
||||
};
|
||||
});
|
||||
|
||||
User[] users =
|
||||
{
|
||||
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 = Array.Empty<string>() },
|
||||
null
|
||||
};
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
[Test]
|
||||
public void TestVisibility()
|
||||
{
|
||||
base.LoadComplete();
|
||||
AddAssert("Is Hidden", () => container.Alpha == 0);
|
||||
|
||||
AddStep("online user (Angelsim)", () =>
|
||||
{
|
||||
var request = new GetUserRequest(1777162);
|
||||
request.Success += user => this.user.Value = user;
|
||||
api.Queue(request);
|
||||
});
|
||||
AddStep("1 username", () => container.User.Value = users[0]);
|
||||
AddUntilStep("Is visible", () => container.Alpha == 1);
|
||||
|
||||
AddStep("2 usernames", () => container.User.Value = users[1]);
|
||||
AddUntilStep("Is visible", () => container.Alpha == 1);
|
||||
|
||||
AddStep("3 usernames", () => container.User.Value = users[2]);
|
||||
AddUntilStep("Is visible", () => container.Alpha == 1);
|
||||
|
||||
AddStep("4 usernames", () => container.User.Value = users[3]);
|
||||
AddUntilStep("Is visible", () => container.Alpha == 1);
|
||||
|
||||
AddStep("No username", () => container.User.Value = users[4]);
|
||||
AddUntilStep("Is hidden", () => container.Alpha == 0);
|
||||
|
||||
AddStep("Null user", () => container.User.Value = users[5]);
|
||||
AddUntilStep("Is hidden", () => container.Alpha == 0);
|
||||
}
|
||||
|
||||
private static readonly User[] users =
|
||||
{
|
||||
new User { Id = 1, PreviousUsernames = new[] { "username1" } },
|
||||
new User { Id = 2, PreviousUsernames = new[] { "longusername", "longerusername" } },
|
||||
new User { Id = 3, PreviousUsernames = new[] { "test", "angelsim", "verylongusername" } },
|
||||
new User { Id = 4, PreviousUsernames = new[] { "ihavenoidea", "howcani", "makethistext", "anylonger" } },
|
||||
new User { Id = 5, PreviousUsernames = Array.Empty<string>() },
|
||||
null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user