1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Merge pull request #22149 from Joehuu/fix-beatmap-set-lookup-type

Fix lookup type being incorrect when fetching beatmap set
This commit is contained in:
Dan Balasescu 2023-01-12 13:00:44 +09:00 committed by GitHub
commit 844fc549e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 1 deletions

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();

View File

@ -138,7 +138,7 @@ namespace osu.Game.Overlays
if (lastLookup == null)
return;
var req = new GetBeatmapSetRequest(lastLookup.Value.id, BeatmapSetLookupType.BeatmapId);
var req = new GetBeatmapSetRequest(lastLookup.Value.id, lastLookup.Value.type);
req.Success += res =>
{
beatmapSet.Value = res;