1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22: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,11 +51,12 @@ 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 BasicScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = new FillFlowContainer Child = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -62,16 +67,15 @@ namespace osu.Game.Tests.Visual.Online
Children = new Drawable[] Children = new Drawable[]
{ {
new DirectGridPanel(normal), new DirectGridPanel(normal),
new DirectGridPanel(downloadable),
undownloadableGridPanel = new DirectGridPanel(undownloadable),
new DirectListPanel(normal), new DirectListPanel(normal),
new DirectListPanel(downloadable), undownloadableGridPanel = new DirectGridPanel(undownloadable),
undownloadableListPanel = new DirectListPanel(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);
} }
} }
} }