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

Cache test request handler in screen navigation test

This commit is contained in:
Bartłomiej Dach 2021-10-27 20:38:52 +02:00
parent cd04ca1240
commit 798349243f
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -9,6 +9,7 @@ using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
@ -24,6 +25,7 @@ using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Options;
using osu.Game.Tests.Beatmaps.IO;
using osu.Game.Tests.Visual.Multiplayer;
using osu.Game.Tests.Visual.OnlinePlay;
using osuTK;
using osuTK.Input;
@ -459,9 +461,19 @@ namespace osu.Game.Tests.Visual.Navigation
[Cached(typeof(MultiplayerClient))]
public readonly TestMultiplayerClient Client;
[Cached]
public readonly TestRoomRequestsHandler RequestsHandler;
public TestMultiplayer()
{
Client = new TestMultiplayerClient((TestMultiplayerRoomManager)RoomManager);
RequestsHandler = new TestRoomRequestsHandler();
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api, OsuGameBase game)
{
((DummyAPIAccess)api).HandleRequest = request => RequestsHandler.HandleRequest(request, api.LocalUser.Value, game);
}
protected override RoomManager CreateRoomManager() => new TestMultiplayerRoomManager();