mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 09:22:54 +08:00
Fix test scene crashing on second run of SetUp
Also correctly support LongRunningLoad
This commit is contained in:
parent
de9c21e7d1
commit
cc3dddf59f
@ -9,6 +9,8 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
@ -29,31 +31,48 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Cached(typeof(UserLookupCache))]
|
[Cached(typeof(UserLookupCache))]
|
||||||
private UserLookupCache lookupCache = new TestSceneCurrentlyPlayingDisplay.TestUserLookupCache();
|
private UserLookupCache lookupCache = new TestSceneCurrentlyPlayingDisplay.TestUserLookupCache();
|
||||||
|
|
||||||
[SetUp]
|
private MultiplayerGameplayLeaderboard leaderboard;
|
||||||
public void SetUp() => Schedule(() =>
|
|
||||||
|
protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
|
public TestSceneMultiplayerGameplayLeaderboard()
|
||||||
{
|
{
|
||||||
OsuScoreProcessor scoreProcessor;
|
base.Content.Children = new Drawable[]
|
||||||
|
|
||||||
streamingClient.Start(Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
streamingClient,
|
streamingClient,
|
||||||
lookupCache,
|
lookupCache,
|
||||||
scoreProcessor = new OsuScoreProcessor(),
|
Content
|
||||||
new MultiplayerGameplayLeaderboard(scoreProcessor, streamingClient.PlayingUsers.ToArray())
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("create leaderboard", () =>
|
||||||
|
{
|
||||||
|
OsuScoreProcessor scoreProcessor;
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||||
|
|
||||||
|
var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
||||||
|
|
||||||
|
streamingClient.Start(Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
scoreProcessor = new OsuScoreProcessor(),
|
||||||
|
};
|
||||||
|
|
||||||
|
scoreProcessor.ApplyBeatmap(playable);
|
||||||
|
|
||||||
|
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, streamingClient.PlayingUsers.ToArray())
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
}
|
}, Add);
|
||||||
};
|
});
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
AddUntilStep("wait for load", () => leaderboard.IsLoaded);
|
||||||
|
}
|
||||||
var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
|
||||||
|
|
||||||
scoreProcessor.ApplyBeatmap(playable);
|
|
||||||
});
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScoreUpdates()
|
public void TestScoreUpdates()
|
||||||
|
Loading…
Reference in New Issue
Block a user