diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 640e895b6c..4f28baa849 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -110,5 +110,31 @@ namespace osu.Game.Tests.Visual.Online } }, new OsuRuleset().RulesetInfo)); } + + [Test] + public void TestPreviousUsernames() + { + AddStep("Show user w/ previous usernames", () => header.User.Value = new UserProfileData(new APIUser + { + Id = 727, + Username = "SomeoneIndecisive", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", + Groups = new[] + { + new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, + }, + Statistics = new UserStatistics + { + IsRanked = false, + // web will sometimes return non-empty rank history even for unranked users. + RankHistory = new APIRankHistory + { + Mode = @"osu", + Data = Enumerable.Range(2345, 85).ToArray() + }, + }, + PreviousUsernames = new[] { "tsrk.", "quoicoubeh", "apagnan", "epita" } + }, new OsuRuleset().RulesetInfo)); + } } } diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index dc47ce6e30..f4f962cdfb 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -46,6 +46,7 @@ namespace osu.Game.Overlays.Profile.Header private OsuSpriteText userCountryText = null!; private GroupBadgeFlow groupBadgeFlow = null!; private ToggleCoverButton coverToggle = null!; + private PreviousUsernames previousUsernames = null!; private Bindable coverExpanded = null!; @@ -143,6 +144,18 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, + new Container + { + Child = previousUsernames = new PreviousUsernames + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Size = new Vector2(0), + Position = new Vector2(10) + } } }, titleText = new OsuSpriteText @@ -216,6 +229,7 @@ namespace osu.Game.Overlays.Profile.Header titleText.Text = user?.Title ?? string.Empty; titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); groupBadgeFlow.User.Value = user; + previousUsernames.User.Value = user; } private void updateCoverState()