mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:12:57 +08:00
Clean up DirectDownloadButton
test scene
This commit is contained in:
parent
a5a7181915
commit
baabe99f78
@ -40,14 +40,14 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddUntilStep("ensure manager loaded", () => beatmaps != null);
|
AddUntilStep("ensure manager loaded", () => beatmaps != null);
|
||||||
ensureSoleilyRemoved();
|
ensureSoleilyRemoved();
|
||||||
createButtonWithBeatmap(createSoleily());
|
createButtonWithBeatmap(CreateAPIBeatmapSet());
|
||||||
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
||||||
AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
||||||
|
|
||||||
AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526));
|
AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526));
|
||||||
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||||
|
|
||||||
createButtonWithBeatmap(createSoleily());
|
createButtonWithBeatmap(CreateAPIBeatmapSet());
|
||||||
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||||
ensureSoleilyRemoved();
|
ensureSoleilyRemoved();
|
||||||
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled);
|
AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createButtonWithBeatmap(IBeatmapSetInfo beatmap)
|
private void createButtonWithBeatmap(APIBeatmapSet beatmap)
|
||||||
{
|
{
|
||||||
AddStep("create button", () =>
|
AddStep("create button", () =>
|
||||||
{
|
{
|
||||||
@ -94,20 +94,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBeatmapSetInfo createSoleily()
|
private APIBeatmapSet getDownloadableBeatmapSet()
|
||||||
{
|
|
||||||
return new APIBeatmapSet
|
|
||||||
{
|
|
||||||
OnlineID = 241526,
|
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
|
||||||
{
|
|
||||||
DownloadDisabled = false,
|
|
||||||
ExternalLink = string.Empty,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private IBeatmapSetInfo getDownloadableBeatmapSet()
|
|
||||||
{
|
{
|
||||||
var apiBeatmapSet = CreateAPIBeatmapSet();
|
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
@ -117,7 +104,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
return apiBeatmapSet;
|
return apiBeatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBeatmapSetInfo getUndownloadableBeatmapSet()
|
private APIBeatmapSet getUndownloadableBeatmapSet()
|
||||||
{
|
{
|
||||||
var apiBeatmapSet = CreateAPIBeatmapSet();
|
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
@ -143,7 +130,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
public DownloadState DownloadState => State.Value;
|
public DownloadState DownloadState => State.Value;
|
||||||
|
|
||||||
public TestDownloadButton(IBeatmapSetInfo beatmapSet)
|
public TestDownloadButton(APIBeatmapSet beatmapSet)
|
||||||
: base(beatmapSet)
|
: base(beatmapSet)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user