1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Convey actual beatmap and ruleset for full testing setup

This commit is contained in:
Dean Herbert 2020-10-26 21:22:01 +09:00
parent 82a27c73a0
commit 9bb2cff8a5

View File

@ -1,8 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Online.Spectator;
using osu.Game.Replays.Legacy;
using osu.Game.Screens.Play;
@ -15,9 +17,13 @@ namespace osu.Game.Tests.Visual.Gameplay
[Cached(typeof(SpectatorStreamingClient))]
private TestSpectatorStreamingClient testSpectatorStreamingClient = new TestSpectatorStreamingClient();
[Resolved]
private OsuGameBase game { get; set; }
[Test]
public void TestSpectating()
{
AddStep("add streaming client", () => Add(testSpectatorStreamingClient));
AddStep("load screen", () => LoadScreen(new Spectator(testSpectatorStreamingClient.StreamingUser)));
AddStep("start play", () => testSpectatorStreamingClient.StartPlay());
AddStep("send frames", () => testSpectatorStreamingClient.SendFrames());
@ -25,11 +31,18 @@ namespace osu.Game.Tests.Visual.Gameplay
internal class TestSpectatorStreamingClient : SpectatorStreamingClient
{
[Resolved]
private BeatmapManager beatmaps { get; set; }
public readonly User StreamingUser = new User { Id = 1234, Username = "Test user" };
public void StartPlay()
{
((ISpectatorClient)this).UserBeganPlaying((int)StreamingUser.Id, new SpectatorState());
((ISpectatorClient)this).UserBeganPlaying((int)StreamingUser.Id, new SpectatorState
{
BeatmapID = beatmaps.GetAllUsableBeatmapSets().First().Beatmaps.First().OnlineBeatmapID,
RulesetID = 0,
});
}
public void SendFrames()