2019-03-04 12:24:19 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-10-13 23:40:33 +08:00
|
|
|
|
2018-10-14 04:20:10 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2018-10-13 23:40:33 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Online.API;
|
|
|
|
using osu.Game.Online.API.Requests;
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
using osu.Game.Tournament.Components;
|
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Tests
|
|
|
|
{
|
|
|
|
public class TestCaseBeatmapPanel : OsuTestCase
|
|
|
|
{
|
|
|
|
[Resolved]
|
2019-04-03 15:22:41 +08:00
|
|
|
private IAPIProvider api { get; set; }
|
2018-10-13 23:40:33 +08:00
|
|
|
|
|
|
|
[Resolved]
|
2018-11-06 13:49:20 +08:00
|
|
|
private RulesetStore rulesets { get; set; }
|
2018-10-13 23:40:33 +08:00
|
|
|
|
2018-10-14 04:20:10 +08:00
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
{
|
|
|
|
typeof(TournamentBeatmapPanel),
|
|
|
|
};
|
|
|
|
|
2018-10-13 23:40:33 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 });
|
|
|
|
req.Success += success;
|
2018-10-14 02:03:17 +08:00
|
|
|
api.Queue(req);
|
2018-10-13 23:40:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void success(APIBeatmap apiBeatmap)
|
|
|
|
{
|
2018-10-14 02:03:17 +08:00
|
|
|
var beatmap = apiBeatmap.ToBeatmap(rulesets);
|
2018-10-13 23:40:33 +08:00
|
|
|
Add(new TournamentBeatmapPanel(beatmap)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|