From a73cf929946cb30ec7154014b66fe091595c6bdc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:27:08 -0300 Subject: [PATCH] Add second UserPanel to visual test, center cover sprite --- .../Tests/TestCaseUserPanel.cs | 42 +++++++++++++------ osu.Game/Users/UserPanel.cs | 3 ++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index ab8bb425a7..efee8e0e24 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -5,6 +5,8 @@ using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Users; +using osu.Framework.Graphics.Containers; +using OpenTK; namespace osu.Desktop.VisualTests.Tests { @@ -16,25 +18,39 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - UserPanel p; - Add(p = new UserPanel(new User - { - Username = @"flyte", - Id = 3103765, - Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" - }) + UserPanel flyte; + UserPanel peppy; + Add(new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Width = 300, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(10f), + Children = new[] + { + flyte = new UserPanel(new User + { + Username = @"flyte", + Id = 3103765, + Country = new Country { FlagName = @"JP" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" + }), + peppy = new UserPanel(new User + { + Username = @"peppy", + Id = 2, + Country = new Country { FlagName = @"AU" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg" + }), + }, }); - p.Status.Value = new UserStatusOnline(); + flyte.Status.Value = new UserStatusOnline(); + peppy.Status.Value = new UserStatusSoloGame(); - AddStep(@"spectating", () => { p.Status.Value = new UserStatusSpectating(); }); - AddStep(@"multiplaying", () => { p.Status.Value = new UserStatusMultiplayerGame(); }); - AddStep(@"modding", () => { p.Status.Value = new UserStatusModding(); }); + AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); + AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); + AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 80d706d985..4de309fb62 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -34,6 +34,7 @@ namespace osu.Game.Users { this.user = user; + Width = 300; Height = height; Masking = true; CornerRadius = 5; @@ -168,6 +169,8 @@ namespace osu.Game.Users cover.Add(new AsyncLoadWrapper(new Sprite { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Texture = textures.Get(user.CoverUrl), FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200),