Fix dependency missing in a few TestScenes

Hopefully these are rather temporary cases until a better solution is
found for these dependency-loading screens.
This commit is contained in:
smoogipoo 2021-10-27 20:47:39 +09:00
parent 48f280440c
commit a87d8d0359
2 changed files with 22 additions and 0 deletions

View File

@ -18,6 +18,7 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms;
using osu.Game.Overlays.Mods;
@ -34,6 +35,7 @@ using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.OnlinePlay;
using osu.Game.Users;
using osuTK.Input;
@ -617,10 +619,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(typeof(MultiplayerClient))]
public readonly TestMultiplayerClient Client;
[Cached]
public readonly TestRoomRequestsHandler RequestsHandler = new TestRoomRequestsHandler();
public DependenciesScreen(TestMultiplayerClient client)
{
Client = client;
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api, OsuGameBase game)
{
((DummyAPIAccess)api).HandleRequest = request => RequestsHandler.HandleRequest(request, api.LocalUser.Value, game);
}
}
private class TestMultiplayer : Screens.OnlinePlay.Multiplayer.Multiplayer

View File

@ -11,6 +11,7 @@ using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
using osu.Game.Online.Rooms;
@ -23,6 +24,7 @@ using osu.Game.Screens.OnlinePlay.Multiplayer;
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
using osu.Game.Screens.OnlinePlay.Multiplayer.Participants;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.OnlinePlay;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Multiplayer
@ -176,10 +178,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(typeof(MultiplayerClient))]
public readonly TestMultiplayerClient Client;
[Cached]
public readonly TestRoomRequestsHandler RequestsHandler = new TestRoomRequestsHandler();
public DependenciesScreen(TestMultiplayerClient client)
{
Client = client;
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api, OsuGameBase game)
{
((DummyAPIAccess)api).HandleRequest = request => RequestsHandler.HandleRequest(request, api.LocalUser.Value, game);
}
}
private class TestMultiplayer : Screens.OnlinePlay.Multiplayer.Multiplayer