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
using osu.Framework.Allocation ;
using osu.Framework.Graphics ;
2021-12-04 22:33:02 +08:00
using osu.Game.Online.API ;
2018-10-13 23:40:33 +08:00
using osu.Game.Online.API.Requests ;
using osu.Game.Online.API.Requests.Responses ;
2021-12-04 22:33:02 +08:00
using osu.Game.Tests.Visual ;
2018-10-13 23:40:33 +08:00
using osu.Game.Tournament.Components ;
2022-06-18 06:34:09 +08:00
using osu.Game.Tournament.Models ;
2018-10-13 23:40:33 +08:00
2019-06-18 14:28:36 +08:00
namespace osu.Game.Tournament.Tests.Components
2018-10-13 23:40:33 +08:00
{
2020-06-24 16:03:22 +08:00
public partial class TestSceneTournamentBeatmapPanel : TournamentTestScene
2018-10-13 23:40:33 +08:00
{
2021-12-04 22:33:02 +08: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 ; } = null ! ;
2018-10-13 23:40:33 +08:00
[BackgroundDependencyLoader]
private void load ( )
{
2021-10-27 16:22:23 +08:00
var req = new GetBeatmapRequest ( new APIBeatmap { OnlineID = 1091460 } ) ;
2018-10-13 23:40:33 +08:00
req . Success + = success ;
2021-12-04 22:33:02 +08:00
api . Queue ( req ) ;
2018-10-13 23:40:33 +08:00
}
2021-10-27 16:22:23 +08:00
private void success ( APIBeatmap beatmap )
2018-10-13 23:40:33 +08:00
{
2022-06-18 06:34:09 +08:00
Add ( new TournamentBeatmapPanel ( new TournamentBeatmap ( beatmap ) )
2018-10-13 23:40:33 +08:00
{
Anchor = Anchor . Centre ,
Origin = Anchor . Centre
} ) ;
}
}
}