From e2cd375029f0734c26d8e0f5382761274b5f7e16 Mon Sep 17 00:00:00 2001 From: StanR Date: Wed, 18 Dec 2024 18:38:01 +0500 Subject: [PATCH] Revert length changes, improve tests --- .../Visual/Online/TestSceneUserPanel.cs | 21 ++++++++++++++++--- osu.Game/Overlays/LoginOverlay.cs | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 49e3a26e36..76f410218a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -48,6 +48,9 @@ namespace osu.Game.Tests.Visual.Online Clear(); Add(statisticsProvider); + // LoginOverlay width (360) - LoginPanel padding (20 on each side) + const int user_rank_panel_width = 320; + Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -103,7 +106,7 @@ namespace osu.Game.Tests.Visual.Online CountryCode = CountryCode.JP, CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg", Statistics = new UserStatistics { GlobalRank = 12345, CountryRank = 1234 } - }) { Width = 360 }, + }) { Width = user_rank_panel_width }, new UserRankPanel(new APIUser { Username = @"peppy", @@ -112,7 +115,7 @@ namespace osu.Game.Tests.Visual.Online CountryCode = CountryCode.AU, CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", Statistics = new UserStatistics { GlobalRank = null, CountryRank = null } - }) { Width = 360 } + }) { Width = user_rank_panel_width } } }); @@ -176,12 +179,24 @@ namespace osu.Game.Tests.Visual.Online PP = RNG.Next(0, 30000) }, Ruleset.Value); }); + AddStep("set statistics to something small", () => + { + statisticsProvider.UpdateStatistics(new UserStatistics + { + GlobalRank = RNG.Next(1, 1000), + CountryRank = RNG.Next(1, 100), + PlayTime = RNG.Next(1_000, 100_000), + PP = RNG.Next(0, 1000) + }, Ruleset.Value); + }); AddStep("set statistics to something big", () => { statisticsProvider.UpdateStatistics(new UserStatistics { GlobalRank = RNG.Next(1_000_000, 100_000_000), - CountryRank = RNG.Next(1_000_000, 100_000_000) + CountryRank = RNG.Next(1_000_000, 100_000_000), + PlayTime = RNG.Next(10_000_000, 1_000_000_000), + PP = RNG.Next(10000, 100000) }, Ruleset.Value); }); AddStep("set statistics to empty", () => statisticsProvider.UpdateStatistics(new UserStatistics(), Ruleset.Value)); diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index d5d2acc82a..d570983f98 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays { new OsuContextMenuContainer { - Width = 400, + Width = 360, AutoSizeAxes = Axes.Y, Children = new Drawable[] {