diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 910fc17fc3..e12299f291 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestSceneBeatmapSetOverlay : OsuTestScene { - private readonly BeatmapSetOverlay overlay; + private readonly TestBeatmapSetOverlay overlay; public override IReadOnlyList RequiredTypes => new[] { @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneBeatmapSetOverlay() { - Add(overlay = new BeatmapSetOverlay()); + Add(overlay = new TestBeatmapSetOverlay()); } [BackgroundDependencyLoader] @@ -435,7 +435,12 @@ namespace osu.Game.Tests.Visual.Online private void downloadAssert(bool shown) { - AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsContainer.Any() == shown); + AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.IsDownloadButtonsShown == shown); + } + + private class TestBeatmapSetOverlay : BeatmapSetOverlay + { + public bool IsDownloadButtonsShown => Header.DownloadButtonsContainer.Any(); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 9667e5a752..7a305f0328 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -52,7 +52,8 @@ namespace osu.Game.Tests.Visual.Online normal.OnlineInfo.HasStoryboard = true; var undownloadable = getUndownloadableBeatmapSet(ruleset); - DirectPanel undownloadableGridPanel, undownloadableListPanel; + TestDirectGridPanel undownloadableGridPanel; + TestDirectListPanel undownloadableListPanel; Child = new BasicScrollContainer { @@ -68,14 +69,34 @@ namespace osu.Game.Tests.Visual.Online { new DirectGridPanel(normal), new DirectListPanel(normal), - undownloadableGridPanel = new DirectGridPanel(undownloadable), - undownloadableListPanel = new DirectListPanel(undownloadable), + undownloadableGridPanel = new TestDirectGridPanel(undownloadable), + undownloadableListPanel = new TestDirectListPanel(undownloadable), }, }, }; - AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.DownloadButton.Enabled.Value); - AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.DownloadButton.Enabled.Value); + AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.IsDownloadButtonEnabled); + AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.IsDownloadButtonEnabled); + } + + private class TestDirectGridPanel : DirectGridPanel + { + public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; + + public TestDirectGridPanel(BeatmapSetInfo beatmap) + : base(beatmap) + { + } + } + + private class TestDirectListPanel : DirectListPanel + { + public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; + + public TestDirectListPanel(BeatmapSetInfo beatmap) + : base(beatmap) + { + } } } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index e17e952df4..b156fe9028 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -34,7 +34,8 @@ namespace osu.Game.Overlays.BeatmapSet private readonly BeatmapNotAvailable beatmapNotAvailable; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; - public FillFlowContainer DownloadButtonsContainer; + + public readonly FillFlowContainer DownloadButtonsContainer; public readonly BeatmapPicker Picker; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index e9ea8f7a55..821840ef95 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays public const float TOP_PADDING = 25; public const float RIGHT_WIDTH = 275; - public readonly Header Header; + protected readonly Header Header; private RulesetStore rulesets; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 9e7aa5372b..5ee00d94d4 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Direct private PlayButton playButton; private Box progressBar; - public override DownloadButton DownloadButton => downloadButton; + protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 076fed19bd..c701002d2e 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Direct protected override bool FadePlayButton => false; - public override DownloadButton DownloadButton => downloadButton; + protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index c9fe4aaa05..c918a84ab0 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -34,7 +34,8 @@ namespace osu.Game.Overlays.Direct public PreviewTrack Preview => PlayButton.Preview; public Bindable PreviewPlaying => PlayButton.Playing; - public abstract DownloadButton DownloadButton { get; } + + protected abstract DownloadButton DownloadButton { get; } protected abstract PlayButton PlayButton { get; } protected abstract Box PreviewBar { get; }