mirror of
https://github.com/ppy/osu
synced 2025-02-01 10:51:53 +00:00
Change TestSceneOsuGame
to use OsuGameTestScene
to avoid async disposal deadlock
The original implementation was done so in a way that the nested `OsuGame` would be disposed via the async queue, causing a deadlock for 10-20s during test runs. `OsuGameTestScene` was already fixed to avoid this, so consuming it here seems like the easy fix.
This commit is contained in:
parent
acaef26af7
commit
7e0379441c
@ -34,7 +34,7 @@ using osuTK.Graphics;
|
|||||||
namespace osu.Game.Tests.Visual.Navigation
|
namespace osu.Game.Tests.Visual.Navigation
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneOsuGame : OsuTestScene
|
public class TestSceneOsuGame : OsuGameTestScene
|
||||||
{
|
{
|
||||||
private IReadOnlyList<Type> requiredGameDependencies => new[]
|
private IReadOnlyList<Type> requiredGameDependencies => new[]
|
||||||
{
|
{
|
||||||
@ -84,34 +84,12 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
typeof(PreviewTrackManager),
|
typeof(PreviewTrackManager),
|
||||||
};
|
};
|
||||||
|
|
||||||
private OsuGame game;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuGameBase gameBase { get; set; }
|
private OsuGameBase gameBase { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
[SetUpSteps]
|
|
||||||
public void SetUpSteps()
|
|
||||||
{
|
|
||||||
AddStep("create game", () =>
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
AddGame(game = new OsuGame());
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => game.IsLoaded);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNullRulesetHandled()
|
public void TestNullRulesetHandled()
|
||||||
{
|
{
|
||||||
@ -127,8 +105,8 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestSwitchThreadExecutionMode()
|
public void TestSwitchThreadExecutionMode()
|
||||||
{
|
{
|
||||||
AddStep("Change thread mode to multi threaded", () => { game.Dependencies.Get<FrameworkConfigManager>().SetValue(FrameworkSetting.ExecutionMode, ExecutionMode.MultiThreaded); });
|
AddStep("Change thread mode to multi threaded", () => { Game.Dependencies.Get<FrameworkConfigManager>().SetValue(FrameworkSetting.ExecutionMode, ExecutionMode.MultiThreaded); });
|
||||||
AddStep("Change thread mode to single thread", () => { game.Dependencies.Get<FrameworkConfigManager>().SetValue(FrameworkSetting.ExecutionMode, ExecutionMode.SingleThread); });
|
AddStep("Change thread mode to single thread", () => { Game.Dependencies.Get<FrameworkConfigManager>().SetValue(FrameworkSetting.ExecutionMode, ExecutionMode.SingleThread); });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -154,7 +132,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
{
|
{
|
||||||
foreach (var type in requiredGameDependencies)
|
foreach (var type in requiredGameDependencies)
|
||||||
{
|
{
|
||||||
if (game.Dependencies.Get(type) == null)
|
if (Game.Dependencies.Get(type) == null)
|
||||||
throw new InvalidOperationException($"{type} has not been cached");
|
throw new InvalidOperationException($"{type} has not been cached");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user