1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:52:57 +08:00

Add failing beatmap set lookup type test

This commit is contained in:
Joseph Madamba 2023-01-11 19:04:55 -08:00
parent 8e022ad4f9
commit f8fade7967

View File

@ -14,6 +14,8 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Testing;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Resources.Localisation.Web;
@ -241,6 +243,44 @@ namespace osu.Game.Tests.Visual.Online
AddStep(@"show without reload", overlay.Show);
}
[TestCase(BeatmapSetLookupType.BeatmapId)]
[TestCase(BeatmapSetLookupType.SetId)]
public void TestFetchLookupType(BeatmapSetLookupType lookupType)
{
string type = string.Empty;
AddStep("register request handling", () =>
{
((DummyAPIAccess)API).HandleRequest = req =>
{
switch (req)
{
case GetBeatmapSetRequest getBeatmapSet:
type = getBeatmapSet.Type.ToString();
return true;
}
return false;
};
});
AddStep(@"fetch", () =>
{
switch (lookupType)
{
case BeatmapSetLookupType.BeatmapId:
overlay.FetchAndShowBeatmap(55);
break;
case BeatmapSetLookupType.SetId:
overlay.FetchAndShowBeatmapSet(55);
break;
}
});
AddAssert(@"type is correct", () => type == lookupType.ToString());
}
private APIBeatmapSet createManyDifficultiesBeatmapSet()
{
var set = getBeatmapSet();