1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:37:42 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
2.3 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-08-13 13:09:10 +08:00
using System;
2019-08-02 02:26:59 +08:00
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Online.API.Requests.Responses;
2019-08-13 13:07:40 +08:00
using osu.Game.Overlays.Profile.Header.Components;
2019-08-02 02:26:59 +08:00
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
{
private PreviousUsernames container;
2019-08-03 09:45:41 +08:00
[SetUp]
2021-10-20 15:54:08 +08:00
public void SetUp() => Schedule(() =>
2019-08-02 02:26:59 +08:00
{
Child = container = new PreviousUsernames
2019-08-02 02:26:59 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
2021-10-20 15:54:08 +08:00
});
2019-08-02 02:26:59 +08:00
[Test]
public void TestVisibility()
{
AddAssert("Is Hidden", () => container.Alpha == 0);
2021-10-20 15:54:08 +08:00
AddStep("1 username", () => container.User.Value = users[0]);
AddUntilStep("Is visible", () => container.Alpha == 1);
2021-10-20 15:54:08 +08:00
AddStep("2 usernames", () => container.User.Value = users[1]);
AddUntilStep("Is visible", () => container.Alpha == 1);
2021-10-20 15:54:08 +08:00
AddStep("3 usernames", () => container.User.Value = users[2]);
AddUntilStep("Is visible", () => container.Alpha == 1);
2019-08-02 12:44:09 +08:00
2021-10-20 15:54:08 +08:00
AddStep("4 usernames", () => container.User.Value = users[3]);
AddUntilStep("Is visible", () => container.Alpha == 1);
2021-10-20 15:54:08 +08:00
AddStep("No username", () => container.User.Value = users[4]);
AddUntilStep("Is hidden", () => container.Alpha == 0);
2021-10-20 15:54:08 +08:00
AddStep("Null user", () => container.User.Value = users[5]);
AddUntilStep("Is hidden", () => container.Alpha == 0);
}
private static readonly APIUser[] users =
{
new APIUser { Id = 1, PreviousUsernames = new[] { "username1" } },
new APIUser { Id = 2, PreviousUsernames = new[] { "longusername", "longerusername" } },
new APIUser { Id = 3, PreviousUsernames = new[] { "test", "angelsim", "verylongusername" } },
new APIUser { Id = 4, PreviousUsernames = new[] { "ihavenoidea", "howcani", "makethistext", "anylonger" } },
new APIUser { Id = 5, PreviousUsernames = Array.Empty<string>() },
null
};
2019-08-02 02:26:59 +08:00
}
}