From ec854f7b7ffeca0aec3a42b1b1355fca1ad3204c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Apr 2025 16:56:20 +0900 Subject: [PATCH] Adjust namespaces and naming --- .../TestSceneCollectionDropdown.cs | 2 +- .../TestSceneManageCollectionsDialog.cs | 2 +- .../TestSceneCollectionDropdown.cs} | 23 ++++++++++--------- .../Music/NowPlayingCollectionDropdown.cs | 2 +- .../SelectV2/CollectionDropdown.cs} | 7 +++--- 5 files changed, 19 insertions(+), 17 deletions(-) rename osu.Game.Tests/Visual/{Collections => SongSelect}/TestSceneCollectionDropdown.cs (99%) rename osu.Game.Tests/Visual/{Collections => SongSelect}/TestSceneManageCollectionsDialog.cs (99%) rename osu.Game.Tests/Visual/{Collections/TestSceneShearedCollectionDropdown.cs => SongSelectV2/TestSceneCollectionDropdown.cs} (90%) rename osu.Game/{Collections/ShearedCollectionDropdown.cs => Screens/SelectV2/CollectionDropdown.cs} (97%) diff --git a/osu.Game.Tests/Visual/Collections/TestSceneCollectionDropdown.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneCollectionDropdown.cs similarity index 99% rename from osu.Game.Tests/Visual/Collections/TestSceneCollectionDropdown.cs rename to osu.Game.Tests/Visual/SongSelect/TestSceneCollectionDropdown.cs index a47f3c5108..fe2bf6ff5d 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneCollectionDropdown.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneCollectionDropdown.cs @@ -22,7 +22,7 @@ using osu.Game.Tests.Resources; using osuTK.Input; using Realms; -namespace osu.Game.Tests.Visual.Collections +namespace osu.Game.Tests.Visual.SongSelect { public partial class TestSceneCollectionDropdown : OsuManualInputManagerTestScene { diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneManageCollectionsDialog.cs similarity index 99% rename from osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs rename to osu.Game.Tests/Visual/SongSelect/TestSceneManageCollectionsDialog.cs index 60675018e9..4c895faf27 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneManageCollectionsDialog.cs @@ -20,7 +20,7 @@ using osu.Game.Tests.Resources; using osuTK; using osuTK.Input; -namespace osu.Game.Tests.Visual.Collections +namespace osu.Game.Tests.Visual.SongSelect { public partial class TestSceneManageCollectionsDialog : OsuManualInputManagerTestScene { diff --git a/osu.Game.Tests/Visual/Collections/TestSceneShearedCollectionDropdown.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneCollectionDropdown.cs similarity index 90% rename from osu.Game.Tests/Visual/Collections/TestSceneShearedCollectionDropdown.cs rename to osu.Game.Tests/Visual/SongSelectV2/TestSceneCollectionDropdown.cs index f1afdf2019..f3c96861ed 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneShearedCollectionDropdown.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneCollectionDropdown.cs @@ -21,13 +21,14 @@ using osu.Game.Rulesets; using osu.Game.Tests.Resources; using osuTK.Input; using Realms; +using CollectionDropdown = osu.Game.Screens.SelectV2.CollectionDropdown; -namespace osu.Game.Tests.Visual.Collections +namespace osu.Game.Tests.Visual.SongSelectV2 { - public partial class TestSceneShearedCollectionDropdown : OsuManualInputManagerTestScene + public partial class TestSceneCollectionDropdown : OsuManualInputManagerTestScene { private BeatmapManager beatmapManager = null!; - private ShearedCollectionDropdown dropdown = null!; + private CollectionDropdown dropdown = null!; [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine); @@ -51,7 +52,7 @@ namespace osu.Game.Tests.Visual.Collections { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Child = dropdown = new ShearedCollectionDropdown + Child = dropdown = new CollectionDropdown { Width = 300, Y = 100, @@ -84,11 +85,11 @@ namespace osu.Game.Tests.Visual.Collections AddStep("add collection", () => writeAndRefresh(r => r.Add(new BeatmapCollection(name: "2")))); AddStep("add collection", () => writeAndRefresh(r => r.Add(new BeatmapCollection(name: "3")))); - AddAssert("check count 5", () => dropdown.ChildrenOfType().Single().ChildrenOfType().Count(), () => Is.EqualTo(5)); + AddAssert("check count 5", () => dropdown.ChildrenOfType().Single().ChildrenOfType().Count(), () => Is.EqualTo(5)); AddStep("delete all collections", () => writeAndRefresh(r => r.RemoveAll())); - AddAssert("check count 2", () => dropdown.ChildrenOfType().Single().ChildrenOfType().Count(), () => Is.EqualTo(2)); + AddAssert("check count 2", () => dropdown.ChildrenOfType().Single().ChildrenOfType().Count(), () => Is.EqualTo(2)); } [Test] @@ -212,12 +213,12 @@ namespace osu.Game.Tests.Visual.Collections AddStep("watch for filter requests", () => { received = false; - dropdown.ChildrenOfType().First().RequestFilter = () => received = true; + dropdown.ChildrenOfType().First().RequestFilter = () => received = true; }); AddStep("click manage collections filter", () => { - int lastItemIndex = dropdown.ChildrenOfType().Single().Items.Count() - 1; + int lastItemIndex = dropdown.ChildrenOfType().Single().Items.Count() - 1; InputManager.MoveMouseTo(getCollectionDropdownItemAt(lastItemIndex)); InputManager.Click(MouseButton.Left); }); @@ -237,7 +238,7 @@ namespace osu.Game.Tests.Visual.Collections private void assertCollectionHeaderDisplays(string collectionName, bool shouldDisplay = true) => AddUntilStep($"collection dropdown header displays '{collectionName}'", - () => shouldDisplay == dropdown.ChildrenOfType().Any(h => h.ChildrenOfType().Any(t => t.Text == collectionName))); + () => shouldDisplay == dropdown.ChildrenOfType().Any(h => h.ChildrenOfType().Any(t => t.Text == collectionName))); private void assertFirstButtonIs(IconUsage icon) => AddUntilStep($"button is {icon.Icon.ToString()}", () => getAddOrRemoveButton(1).Icon.Equals(icon)); @@ -251,7 +252,7 @@ namespace osu.Game.Tests.Visual.Collections private void addExpandHeaderStep() => AddStep("expand header", () => { - InputManager.MoveMouseTo(dropdown.ChildrenOfType().Single()); + InputManager.MoveMouseTo(dropdown.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); @@ -264,7 +265,7 @@ namespace osu.Game.Tests.Visual.Collections private Menu.DrawableMenuItem getCollectionDropdownItemAt(int index) { // todo: we should be able to use Items, but apparently that's not guaranteed to be ordered... see: https://github.com/ppy/osu-framework/pull/6079 - CollectionFilterMenuItem item = dropdown.ChildrenOfType().Single().ItemSource.ElementAt(index); + CollectionFilterMenuItem item = dropdown.ChildrenOfType().Single().ItemSource.ElementAt(index); return dropdown.ChildrenOfType().Single(i => i.Item.Text.Value == item.CollectionName); } } diff --git a/osu.Game/Overlays/Music/NowPlayingCollectionDropdown.cs b/osu.Game/Overlays/Music/NowPlayingCollectionDropdown.cs index 0f2e9400d9..2ba222b976 100644 --- a/osu.Game/Overlays/Music/NowPlayingCollectionDropdown.cs +++ b/osu.Game/Overlays/Music/NowPlayingCollectionDropdown.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Music /// /// A for use in the . /// - public partial class NowPlayingCollectionDropdown : CollectionDropdown + public partial class NowPlayingCollectionDropdown : CollectionDropdown // TODO: class is now unused. if we decide this isn't coming back it can be nuked. { protected override bool ShowManageCollectionsItem => false; diff --git a/osu.Game/Collections/ShearedCollectionDropdown.cs b/osu.Game/Screens/SelectV2/CollectionDropdown.cs similarity index 97% rename from osu.Game/Collections/ShearedCollectionDropdown.cs rename to osu.Game/Screens/SelectV2/CollectionDropdown.cs index 2bb2f5bfe7..a2a2ec1c93 100644 --- a/osu.Game/Collections/ShearedCollectionDropdown.cs +++ b/osu.Game/Screens/SelectV2/CollectionDropdown.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; +using osu.Game.Collections; using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -20,12 +21,12 @@ using osu.Game.Graphics.UserInterfaceV2; using osuTK; using Realms; -namespace osu.Game.Collections +namespace osu.Game.Screens.SelectV2 { /// /// A dropdown to select the collection to be used to filter results. /// - public partial class ShearedCollectionDropdown : ShearedDropdown + public partial class CollectionDropdown : ShearedDropdown // TODO: partial class under FilterControl? { /// /// Whether to show the "manage collections..." menu item in the dropdown. @@ -46,7 +47,7 @@ namespace osu.Game.Collections private readonly CollectionFilterMenuItem allBeatmapsItem = new AllBeatmapsCollectionFilterMenuItem(); - public ShearedCollectionDropdown() + public CollectionDropdown() : base("Collection") { ItemSource = filters;