mirror of
https://github.com/ppy/osu.git
synced 2024-11-16 01:17:27 +08:00
Make fields protected and expose them in tests
This commit is contained in:
parent
eaf6f6891d
commit
9ada4d68b1
@ -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<Type> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -34,7 +34,8 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
public PreviewTrack Preview => PlayButton.Preview;
|
||||
public Bindable<bool> PreviewPlaying => PlayButton.Playing;
|
||||
public abstract DownloadButton DownloadButton { get; }
|
||||
|
||||
protected abstract DownloadButton DownloadButton { get; }
|
||||
protected abstract PlayButton PlayButton { get; }
|
||||
protected abstract Box PreviewBar { get; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user