osu/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2019-03-04 04:24:19 +00: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 15:40:33 +00:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Online.API;
2018-10-13 15:40:33 +00:00
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Tests.Visual;
2018-10-13 15:40:33 +00:00
using osu.Game.Tournament.Components;
2019-06-18 06:28:36 +00:00
namespace osu.Game.Tournament.Tests.Components
2018-10-13 15:40:33 +00:00
{
public class TestSceneTournamentBeatmapPanel : TournamentTestScene
2018-10-13 15:40:33 +00:00
{
/// <remarks>
/// Warning: the below API instance is actually the online API, rather than the dummy API provided by the test.
/// It cannot be trivially replaced because setting <see cref="OsuTestScene.UseOnlineAPI"/> to <see langword="true"/> causes <see cref="OsuTestScene.API"/> to no longer be usable.
/// </remarks>
[Resolved]
private IAPIProvider api { get; set; }
2018-10-13 15:40:33 +00:00
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 1091460 });
2018-10-13 15:40:33 +00:00
req.Success += success;
api.Queue(req);
2018-10-13 15:40:33 +00:00
}
private void success(APIBeatmap beatmap)
2018-10-13 15:40:33 +00:00
{
Add(new TournamentBeatmapPanel(beatmap)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
}
}