1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Update direct panel test

This commit is contained in:
KingLuigi4932 2019-06-20 18:57:52 +03:00
parent a9f87e06f8
commit eb9022257d

View File

@ -23,16 +23,20 @@ namespace osu.Game.Tests.Visual.Online
typeof(IconPill) typeof(IconPill)
}; };
private BeatmapSetInfo getBeatmapSet(RulesetInfo ruleset, bool downloadable) private BeatmapSetInfo getUndownloadableBeatmapSet(RulesetInfo ruleset)
{ {
var beatmap = CreateWorkingBeatmap(ruleset).BeatmapSetInfo; var beatmap = CreateWorkingBeatmap(ruleset).BeatmapSetInfo;
beatmap.Metadata.Artist = "test";
beatmap.Metadata.Title = "undownloadable";
beatmap.Metadata.AuthorString = "test";
beatmap.OnlineInfo.HasVideo = true; beatmap.OnlineInfo.HasVideo = true;
beatmap.OnlineInfo.HasStoryboard = true; beatmap.OnlineInfo.HasStoryboard = true;
beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability
{ {
DownloadDisabled = !downloadable, DownloadDisabled = true,
ExternalLink = "http://localhost", ExternalLink = "http://osu.ppy.sh",
}; };
return beatmap; return beatmap;
@ -47,31 +51,31 @@ namespace osu.Game.Tests.Visual.Online
normal.OnlineInfo.HasVideo = true; normal.OnlineInfo.HasVideo = true;
normal.OnlineInfo.HasStoryboard = true; normal.OnlineInfo.HasStoryboard = true;
var downloadable = getBeatmapSet(ruleset, true); var undownloadable = getUndownloadableBeatmapSet(ruleset);
var undownloadable = getBeatmapSet(ruleset, false);
DirectPanel undownloadableGridPanel, undownloadableListPanel; DirectPanel undownloadableGridPanel, undownloadableListPanel;
Child = new FillFlowContainer Child = new BasicScrollContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y, Child = new FillFlowContainer
Direction = FillDirection.Vertical,
Padding = new MarginPadding(20),
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{ {
new DirectGridPanel(normal), RelativeSizeAxes = Axes.X,
new DirectGridPanel(downloadable), AutoSizeAxes = Axes.Y,
undownloadableGridPanel = new DirectGridPanel(undownloadable), Direction = FillDirection.Vertical,
new DirectListPanel(normal), Padding = new MarginPadding(20),
new DirectListPanel(downloadable), Spacing = new Vector2(0, 20),
undownloadableListPanel = new DirectListPanel(undownloadable), Children = new Drawable[]
{
new DirectGridPanel(normal),
new DirectListPanel(normal),
undownloadableGridPanel = new DirectGridPanel(undownloadable),
undownloadableListPanel = new DirectListPanel(undownloadable),
},
}, },
}; };
AddAssert("is download button disabled on last grid panel", () => !undownloadableGridPanel.DownloadButton.Enabled.Value); AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.DownloadButton.Enabled.Value);
AddAssert("is download button disabled on last list panel", () => !undownloadableListPanel.DownloadButton.Enabled.Value); AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.DownloadButton.Enabled.Value);
} }
} }
} }