diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestSceneDifficultyStatisticsDisplay.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneDifficultyStatisticsDisplay.cs index 3dd6fed708..0ee742a09d 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestSceneDifficultyStatisticsDisplay.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneDifficultyStatisticsDisplay.cs @@ -162,5 +162,23 @@ namespace osu.Game.Tests.Visual.SongSelectV2 AddAssert("statistics still visible", () => display.ChildrenOfType().First().Parent!.Alpha == 1); AddAssert("tiny statistics still hidden", () => display.ChildrenOfType().Last().Alpha == 0); } + + [Test] + public void TestMaximumLength() + { + AddStep("setup auto size", () => Child = display = new BeatmapTitleWedge.DifficultyStatisticsDisplay(true) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + + AddStep("set long statistics", () => display.Statistics = new[] + { + new BeatmapTitleWedge.StatisticDifficulty.Data("Very Long Statistic 1", 0.2f, 0.2f, 1f), + new BeatmapTitleWedge.StatisticDifficulty.Data("Very Long Statistic 2", 0.7f, 0.7f, 1f), + new BeatmapTitleWedge.StatisticDifficulty.Data("Very Long Statistic 3", 0.4f, 0.8f, 1f), + new BeatmapTitleWedge.StatisticDifficulty.Data("Very Long Statistic 4", 0.3f, 0.3f, 1f), + }); + } } } diff --git a/osu.Game/Screens/SelectV2/BeatmapTitleWedge_StatisticDifficulty.cs b/osu.Game/Screens/SelectV2/BeatmapTitleWedge_StatisticDifficulty.cs index b533d21c1e..d0b6acca88 100644 --- a/osu.Game/Screens/SelectV2/BeatmapTitleWedge_StatisticDifficulty.cs +++ b/osu.Game/Screens/SelectV2/BeatmapTitleWedge_StatisticDifficulty.cs @@ -98,10 +98,11 @@ namespace osu.Game.Screens.SelectV2 }, }, }, - labelText = new OsuSpriteText + labelText = new TruncatingSpriteText { Margin = new MarginPadding { Top = 2f }, Font = OsuFont.Style.Caption1.With(weight: FontWeight.SemiBold), + MaxWidth = 85, }, new FillFlowContainer {