mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 05:22:54 +08:00
Add very basic test logic to ensure PlayerLoader
is present for playlists
This commit is contained in:
parent
9e8c0a7e70
commit
48672f8afd
@ -11,11 +11,13 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.OnlinePlay;
|
using osu.Game.Screens.OnlinePlay;
|
||||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -24,8 +26,6 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
public class TestScenePlaylistsRoomSubScreen : RoomTestScene
|
public class TestScenePlaylistsRoomSubScreen : RoomTestScene
|
||||||
{
|
{
|
||||||
protected override bool UseOnlineAPI => true;
|
|
||||||
|
|
||||||
[Cached(typeof(IRoomManager))]
|
[Cached(typeof(IRoomManager))]
|
||||||
private readonly TestRoomManager roomManager = new TestRoomManager();
|
private readonly TestRoomManager roomManager = new TestRoomManager();
|
||||||
|
|
||||||
@ -41,6 +41,18 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
||||||
|
|
||||||
manager.Import(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Wait();
|
manager.Import(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Wait();
|
||||||
|
|
||||||
|
((DummyAPIAccess)API).HandleRequest = req =>
|
||||||
|
{
|
||||||
|
switch (req)
|
||||||
|
{
|
||||||
|
case CreateRoomScoreRequest createRoomScoreRequest:
|
||||||
|
createRoomScoreRequest.TriggerSuccess(new APIScoreToken { ID = 1 });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
@ -59,12 +71,16 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
Room.Name.Value = "my awesome room";
|
Room.Name.Value = "my awesome room";
|
||||||
Room.Host.Value = new User { Id = 2, Username = "peppy" };
|
Room.Host.Value = new User { Id = 2, Username = "peppy" };
|
||||||
Room.RecentParticipants.Add(Room.Host.Value);
|
Room.RecentParticipants.Add(Room.Host.Value);
|
||||||
|
Room.EndDate.Value = DateTimeOffset.Now.AddMinutes(5);
|
||||||
Room.Playlist.Add(new PlaylistItem
|
Room.Playlist.Add(new PlaylistItem
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
||||||
Ruleset = { Value = new OsuRuleset().RulesetInfo }
|
Ruleset = { Value = new OsuRuleset().RulesetInfo }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().Click());
|
||||||
|
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -150,7 +150,11 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
protected void StartPlay()
|
protected void StartPlay()
|
||||||
{
|
{
|
||||||
sampleStart?.Play();
|
sampleStart?.Play();
|
||||||
ParentScreen?.Push(CreateGameplayScreen());
|
|
||||||
|
// fallback is to allow this class to operate when there is no parent OnlineScreen (testing purposes).
|
||||||
|
var targetScreen = (Screen)ParentScreen ?? this;
|
||||||
|
|
||||||
|
targetScreen?.Push(CreateGameplayScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user