mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Refactor test to more closely match how OsuGameDesktop works
This commit is contained in:
parent
651d7264fc
commit
13fc649edf
@ -23,11 +23,12 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
private HeadlessGameHost ipcSenderHost = null!;
|
||||
|
||||
private OsuSchemeLinkIPCChannel osuSchemeLinkIPCReceiver = null!;
|
||||
private OsuSchemeLinkIPCChannel osuSchemeLinkIPCSender = null!;
|
||||
|
||||
private const int requested_beatmap_set_id = 1;
|
||||
|
||||
protected override TestOsuGame CreateTestGame() => new IpcGame(LocalStorage, API);
|
||||
|
||||
[Resolved]
|
||||
private GameHost gameHost { get; set; } = null!;
|
||||
|
||||
@ -56,7 +57,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
return false;
|
||||
};
|
||||
});
|
||||
AddStep("create IPC receiver channel", () => osuSchemeLinkIPCReceiver = new OsuSchemeLinkIPCChannel(gameHost, Game));
|
||||
AddStep("create IPC sender channel", () =>
|
||||
{
|
||||
ipcSenderHost = new HeadlessGameHost(gameHost.Name, new HostOptions { BindIPC = true });
|
||||
@ -74,7 +74,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
public override void TearDownSteps()
|
||||
{
|
||||
AddStep("dispose IPC receiver", () => osuSchemeLinkIPCReceiver.Dispose());
|
||||
AddStep("dispose IPC sender", () =>
|
||||
{
|
||||
osuSchemeLinkIPCSender.Dispose();
|
||||
@ -82,5 +81,27 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
});
|
||||
base.TearDownSteps();
|
||||
}
|
||||
|
||||
private partial class IpcGame : TestOsuGame
|
||||
{
|
||||
private OsuSchemeLinkIPCChannel? osuSchemeLinkIPCChannel;
|
||||
|
||||
public IpcGame(Storage storage, IAPIProvider api, string[]? args = null)
|
||||
: base(storage, api, args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
osuSchemeLinkIPCChannel = new OsuSchemeLinkIPCChannel(Host, this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
osuSchemeLinkIPCChannel?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user