mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Allow creating sample API models without specifying a ruleset
This commit is contained in:
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -202,7 +203,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestDownloadButtonHiddenWhenBeatmapExists()
|
public void TestDownloadButtonHiddenWhenBeatmapExists()
|
||||||
{
|
{
|
||||||
var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
var beatmap = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
AddStep("import beatmap", () => manager.Import(beatmap.BeatmapSet).Wait());
|
AddStep("import beatmap", () => manager.Import(beatmap.BeatmapSet).Wait());
|
||||||
|
|
||||||
@ -223,11 +224,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestDownloadButtonVisibleInitiallyWhenBeatmapDoesNotExist()
|
public void TestDownloadButtonVisibleInitiallyWhenBeatmapDoesNotExist()
|
||||||
{
|
{
|
||||||
var byOnlineId = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
var byOnlineId = CreateAPIBeatmapSet();
|
||||||
byOnlineId.BeatmapSet.OnlineBeatmapSetID = 1337; // Some random ID that does not exist locally.
|
byOnlineId.OnlineID = 1337; // Some random ID that does not exist locally.
|
||||||
|
|
||||||
var byChecksum = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
var byChecksum = CreateAPIBeatmapSet();
|
||||||
byChecksum.MD5Hash = "1337"; // Some random checksum that does not exist locally.
|
byChecksum.Beatmaps.ForEach(b => b.Checksum = "1337"); // Some random checksum that does not exist locally.
|
||||||
|
|
||||||
createPlaylist(byOnlineId, byChecksum);
|
createPlaylist(byOnlineId, byChecksum);
|
||||||
|
|
||||||
@ -237,8 +238,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestExplicitBeatmapItem()
|
public void TestExplicitBeatmapItem()
|
||||||
{
|
{
|
||||||
var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
var beatmap = CreateAPIBeatmapSet();
|
||||||
beatmap.BeatmapSet.OnlineInfo.HasExplicitContent = true;
|
|
||||||
|
beatmap.HasExplicitContent = true;
|
||||||
|
|
||||||
createPlaylist(beatmap);
|
createPlaylist(beatmap);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Rulesets.Osu;
|
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -110,7 +109,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
private IBeatmapSetInfo getDownloadableBeatmapSet()
|
private IBeatmapSetInfo getDownloadableBeatmapSet()
|
||||||
{
|
{
|
||||||
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
apiBeatmapSet.HasVideo = true;
|
apiBeatmapSet.HasVideo = true;
|
||||||
apiBeatmapSet.HasStoryboard = true;
|
apiBeatmapSet.HasStoryboard = true;
|
||||||
@ -120,7 +119,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
private IBeatmapSetInfo getUndownloadableBeatmapSet()
|
private IBeatmapSetInfo getUndownloadableBeatmapSet()
|
||||||
{
|
{
|
||||||
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
apiBeatmapSet.Artist = "test";
|
apiBeatmapSet.Artist = "test";
|
||||||
apiBeatmapSet.Title = "undownloadable";
|
apiBeatmapSet.Title = "undownloadable";
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
|
AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
|
||||||
{
|
{
|
||||||
OnlineInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet.OnlineInfo,
|
OnlineInfo = CreateAPIBeatmapSet(),
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
});
|
});
|
||||||
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddStep("setup covers", () =>
|
AddStep("setup covers", () =>
|
||||||
{
|
{
|
||||||
BeatmapSetInfo setInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet;
|
var beatmapSet = CreateAPIBeatmapSet();
|
||||||
|
|
||||||
FillFlowContainer fillFlow;
|
FillFlowContainer fillFlow;
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover
|
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
OnlineInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet.OnlineInfo,
|
OnlineInfo = CreateAPIBeatmapSet(),
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
});
|
});
|
||||||
|
@ -178,10 +178,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sample API Beatmap with BeatmapSet populated.
|
/// Returns a sample API Beatmap with BeatmapSet populated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset to create the sample model using.</param>
|
/// <param name="ruleset">The ruleset to create the sample model using. osu! ruleset will be used if not specified.</param>
|
||||||
protected APIBeatmap CreateAPIBeatmap(RulesetInfo ruleset)
|
protected APIBeatmap CreateAPIBeatmap(RulesetInfo ruleset = null)
|
||||||
{
|
{
|
||||||
var beatmapSet = CreateAPIBeatmapSet(ruleset);
|
var beatmapSet = CreateAPIBeatmapSet(ruleset ?? Ruleset.Value);
|
||||||
|
|
||||||
// Avoid circular reference.
|
// Avoid circular reference.
|
||||||
var beatmap = beatmapSet.Beatmaps.First();
|
var beatmap = beatmapSet.Beatmaps.First();
|
||||||
@ -196,10 +196,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sample API BeatmapSet with beatmaps populated.
|
/// Returns a sample API BeatmapSet with beatmaps populated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset to create the sample model using.</param>
|
/// <param name="ruleset">The ruleset to create the sample model using. osu! ruleset will be used if not specified.</param>
|
||||||
protected APIBeatmapSet CreateAPIBeatmapSet(RulesetInfo ruleset)
|
protected APIBeatmapSet CreateAPIBeatmapSet(RulesetInfo ruleset = null)
|
||||||
{
|
{
|
||||||
var beatmap = CreateBeatmap(ruleset).BeatmapInfo;
|
var beatmap = CreateBeatmap(ruleset ?? Ruleset.Value).BeatmapInfo;
|
||||||
|
|
||||||
return new APIBeatmapSet
|
return new APIBeatmapSet
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user