mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 10:22:56 +08:00
Fix incorrect usages of user lookup cache in tests
This commit is contained in:
parent
2675bb87ff
commit
539cbe62c6
@ -39,7 +39,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Resolved]
|
||||
private OsuGameBase game { get; set; }
|
||||
|
||||
private TestSpectatorClient spectatorClient;
|
||||
private TestSpectatorClient spectatorClient => dependenciesScreen.Client;
|
||||
private DependenciesScreen dependenciesScreen;
|
||||
private SoloSpectator spectatorScreen;
|
||||
|
||||
private BeatmapSetInfo importedBeatmap;
|
||||
@ -48,16 +49,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[SetUpSteps]
|
||||
public void SetupSteps()
|
||||
{
|
||||
DependenciesScreen dependenciesScreen = null;
|
||||
|
||||
AddStep("load dependencies", () =>
|
||||
{
|
||||
spectatorClient = new TestSpectatorClient();
|
||||
LoadScreen(dependenciesScreen = new DependenciesScreen());
|
||||
|
||||
// The screen gets suspended so it stops receiving updates.
|
||||
Child = spectatorClient;
|
||||
|
||||
LoadScreen(dependenciesScreen = new DependenciesScreen(spectatorClient));
|
||||
// The dependencies screen gets suspended so it stops receiving updates. So its children are manually added to the test scene instead.
|
||||
Children = new Drawable[]
|
||||
{
|
||||
dependenciesScreen.UserLookupCache,
|
||||
dependenciesScreen.Client,
|
||||
};
|
||||
});
|
||||
|
||||
AddUntilStep("wait for dependencies to load", () => dependenciesScreen.IsLoaded);
|
||||
@ -335,12 +336,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private class DependenciesScreen : OsuScreen
|
||||
{
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
public readonly TestSpectatorClient Client;
|
||||
public readonly TestSpectatorClient Client = new TestSpectatorClient();
|
||||
|
||||
public DependenciesScreen(TestSpectatorClient client)
|
||||
{
|
||||
Client = client;
|
||||
}
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
public readonly TestUserLookupCache UserLookupCache = new TestUserLookupCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
@ -41,9 +40,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
protected TestMultiplayerClient Client => multiplayerComponents.Client;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
|
@ -30,16 +30,13 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneDrawableRoomPlaylist : OsuManualInputManagerTestScene
|
||||
public class TestSceneDrawableRoomPlaylist : MultiplayerTestScene
|
||||
{
|
||||
private TestPlaylist playlist;
|
||||
|
||||
private BeatmapManager manager;
|
||||
private RulesetStore rulesets;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private readonly TestUserLookupCache userLookupCache = new TestUserLookupCache();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
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.API.Requests.Responses;
|
||||
@ -56,9 +55,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
private TestMultiplayerClient client => multiplayerComponents.Client;
|
||||
private TestMultiplayerRoomManager roomManager => multiplayerComponents.RoomManager;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -26,9 +25,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMultiplayerQueueList : MultiplayerTestScene
|
||||
{
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private readonly TestUserLookupCache userLookupCache = new TestUserLookupCache();
|
||||
|
||||
private MultiplayerQueueList playlist;
|
||||
private BeatmapManager beatmaps;
|
||||
private RulesetStore rulesets;
|
||||
|
@ -4,13 +4,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Online.API;
|
||||
@ -20,18 +18,16 @@ using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestScenePlaylistsRoomSettingsPlaylist : OsuManualInputManagerTestScene
|
||||
public class TestScenePlaylistsRoomSettingsPlaylist : OnlinePlayTestScene
|
||||
{
|
||||
private TestPlaylist playlist;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private readonly TestUserLookupCache userLookupCache = new TestUserLookupCache();
|
||||
|
||||
[Test]
|
||||
public void TestItemRemovedOnDeletion()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Extensions;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||
@ -36,9 +35,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
private TestMultiplayerClient client => multiplayerComponents.Client;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens;
|
||||
@ -39,6 +40,12 @@ namespace osu.Game.Tests.Visual
|
||||
[Cached(typeof(MultiplayerClient))]
|
||||
public readonly TestMultiplayerClient Client;
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private readonly UserLookupCache userLookupCache = new TestUserLookupCache();
|
||||
|
||||
[Cached]
|
||||
private readonly BeatmapLookupCache beatmapLookupCache = new BeatmapLookupCache();
|
||||
|
||||
private readonly OsuScreenStack screenStack;
|
||||
private readonly TestMultiplayer multiplayerScreen;
|
||||
|
||||
@ -48,6 +55,8 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
userLookupCache,
|
||||
beatmapLookupCache,
|
||||
Client = new TestMultiplayerClient(RoomManager),
|
||||
screenStack = new OsuScreenStack
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user