mirror of
https://github.com/osukey/osukey.git
synced 2025-05-06 06:07:26 +09:00
Add subscreen test scene
This commit is contained in:
parent
b5f048ce96
commit
1e80facfe8
87
osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs
Normal file
87
osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs
Normal file
@ -0,0 +1,87 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Multi.Match;
|
||||
using osu.Game.Screens.Multi.Match.Components;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMatchSubScreen : ScreenTestScene
|
||||
{
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(Screens.Multi.Multiplayer),
|
||||
typeof(MatchSubScreen),
|
||||
typeof(Header),
|
||||
typeof(Footer)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>();
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
public TestSceneMatchSubScreen()
|
||||
{
|
||||
currentRoom.Value = new Room();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowRoom()
|
||||
{
|
||||
AddStep(@"show", () =>
|
||||
{
|
||||
currentRoom.Value.RoomID.Value = 1;
|
||||
currentRoom.Value.Availability.Value = RoomAvailability.Public;
|
||||
currentRoom.Value.Duration.Value = TimeSpan.FromHours(24);
|
||||
currentRoom.Value.Host.Value = new User { Username = "peppy", Id = 2 };
|
||||
currentRoom.Value.Name.Value = "super secret room";
|
||||
currentRoom.Value.Participants.AddRange(new[]
|
||||
{
|
||||
new User { Username = "peppy", Id = 2 },
|
||||
new User { Username = "smoogipoo", Id = 1040328 }
|
||||
});
|
||||
currentRoom.Value.Playlist.Add(new PlaylistItem
|
||||
{
|
||||
Beatmap = { Value = beatmaps.GetAllUsableBeatmapSets()[0].Beatmaps[0] },
|
||||
Ruleset = { Value = rulesets.GetRuleset(2) },
|
||||
});
|
||||
|
||||
LoadScreen(new MatchSubScreen(currentRoom.Value));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowSettings()
|
||||
{
|
||||
AddStep(@"show", () =>
|
||||
{
|
||||
currentRoom.Value.RoomID.Value = null;
|
||||
LoadScreen(new MatchSubScreen(currentRoom.Value));
|
||||
});
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
var dependencies = new CachedModelDependencyContainer<Room>(base.CreateChildDependencies(parent));
|
||||
dependencies.Model.BindTo(currentRoom);
|
||||
return dependencies;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user