From 6ac4f482ee2151998f89b4fa7e7f16666e15583d Mon Sep 17 00:00:00 2001 From: tadatomix Date: Sun, 28 Sep 2025 23:10:32 +0300 Subject: [PATCH] Add a new test for `Rank Achieved` panels --- .../SongSelectV2/TestScenePanelGroup.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelGroup.cs b/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelGroup.cs index 3b9a07437a..e6a58136fa 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelGroup.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelGroup.cs @@ -3,12 +3,14 @@ using System; using NUnit.Framework; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Graphics.Carousel; using osu.Game.Graphics.Cursor; +using osu.Game.Scoring; using osu.Game.Screens.SelectV2; using osu.Game.Tests.Visual.UserInterface; using osuTK; @@ -86,6 +88,64 @@ namespace osu.Game.Tests.Visual.SongSelectV2 } } + [Test] + public void TestRanks() + { + for (int i = -1; i <= 7; i++) + { + ScoreRank rank = (ScoreRank)i; + + AddStep($"display rank {rank}", () => + { + ContentContainer.Child = new DependencyProvidingContainer + { + RelativeSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] + { + (typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Aquamarine)) + }, + Child = new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Child = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 0.5f, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 5f), + Children = new[] + { + new PanelGroupRankDisplay + { + Item = new CarouselItem(new RankDisplayGroupDefinition(0, $"{rank.GetDescription()}", rank)) + }, + new PanelGroupRankDisplay + { + Item = new CarouselItem(new RankDisplayGroupDefinition(1, $"{rank.GetDescription()}", rank)), + KeyboardSelected = { Value = true }, + }, + new PanelGroupRankDisplay + { + Item = new CarouselItem(new RankDisplayGroupDefinition(2, $"{rank.GetDescription()}", rank)), + Expanded = { Value = true }, + }, + new PanelGroupRankDisplay + { + Item = new CarouselItem(new RankDisplayGroupDefinition(3, $"{rank.GetDescription()}", rank)), + Expanded = { Value = true }, + KeyboardSelected = { Value = true }, + }, + }, + } + } + }; + }); + } + } + protected override Drawable CreateContent() { return new OsuContextMenuContainer