1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 14:27:51 +08:00

Fix UserRankPanel rank overflowing on 6+ digits

This commit is contained in:
StanR 2024-10-27 13:40:29 +05:00
parent 09582aa653
commit 86989aa5ce
2 changed files with 15 additions and 7 deletions

View File

@ -55,21 +55,21 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"flyte", Username = @"flyte",
Id = 3103765, Id = 3103765,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg",
}), }),
new UserBrickPanel(new APIUser new UserBrickPanel(new APIUser
{ {
Username = @"peppy", Username = @"peppy",
Id = 2, Id = 2,
Colour = "99EB47", Colour = "99EB47",
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
}), }),
new UserGridPanel(new APIUser new UserGridPanel(new APIUser
{ {
Username = @"flyte", Username = @"flyte",
Id = 3103765, Id = 3103765,
CountryCode = CountryCode.JP, CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg",
Status = { Value = UserStatus.Online } Status = { Value = UserStatus.Online }
}) { Width = 300 }, }) { Width = 300 },
boundPanel1 = new UserGridPanel(new APIUser boundPanel1 = new UserGridPanel(new APIUser
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Online
Username = @"peppy", Username = @"peppy",
Id = 2, Id = 2,
CountryCode = CountryCode.AU, CountryCode = CountryCode.AU,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
IsSupporter = true, IsSupporter = true,
SupportLevel = 3, SupportLevel = 3,
}) { Width = 300 }, }) { Width = 300 },
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online
Username = @"flyte", Username = @"flyte",
Id = 3103765, Id = 3103765,
CountryCode = CountryCode.JP, CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg",
Statistics = new UserStatistics { GlobalRank = 12345, CountryRank = 1234 } Statistics = new UserStatistics { GlobalRank = 12345, CountryRank = 1234 }
}) { Width = 300 }, }) { Width = 300 },
new UserRankPanel(new APIUser new UserRankPanel(new APIUser
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual.Online
Id = 2, Id = 2,
Colour = "99EB47", Colour = "99EB47",
CountryCode = CountryCode.AU, CountryCode = CountryCode.AU,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
Statistics = new UserStatistics { GlobalRank = null, CountryRank = null } Statistics = new UserStatistics { GlobalRank = null, CountryRank = null }
}) { Width = 300 } }) { Width = 300 }
} }
@ -168,6 +168,14 @@ namespace osu.Game.Tests.Visual.Online
CountryRank = RNG.Next(100000) CountryRank = RNG.Next(100000)
}); });
}); });
AddStep("set statistics to something big", () =>
{
API.UpdateStatistics(new UserStatistics
{
GlobalRank = RNG.Next(1_000_000, 100_000_000),
CountryRank = RNG.Next(1_000_000, 100_000_000)
});
});
AddStep("set statistics to empty", () => AddStep("set statistics to empty", () =>
{ {
API.UpdateStatistics(new UserStatistics()); API.UpdateStatistics(new UserStatistics());

View File

@ -152,7 +152,7 @@ namespace osu.Game.Users
Margin = new MarginPadding { Top = main_content_height }, Margin = new MarginPadding { Top = main_content_height },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 80, Vertical = padding }, Padding = new MarginPadding(padding),
ColumnDimensions = new[] ColumnDimensions = new[]
{ {
new Dimension(), new Dimension(),