2020-12-20 15:04:06 +00:00
|
|
|
// 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.Screens;
|
|
|
|
using osu.Framework.Testing;
|
2020-12-25 04:38:11 +00:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-20 15:04:06 +00:00
|
|
|
using osu.Game.Rulesets.Osu;
|
2020-12-25 15:50:00 +00:00
|
|
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
2020-12-20 15:04:06 +00:00
|
|
|
using osu.Game.Tests.Beatmaps;
|
|
|
|
using osuTK.Input;
|
|
|
|
|
2020-12-25 04:20:37 +00:00
|
|
|
namespace osu.Game.Tests.Visual.Multiplayer
|
2020-12-20 15:04:06 +00:00
|
|
|
{
|
2020-12-25 04:38:11 +00:00
|
|
|
public class TestSceneMultiplayerMatchSubScreen : MultiplayerTestScene
|
2020-12-20 15:04:06 +00:00
|
|
|
{
|
2020-12-25 04:38:11 +00:00
|
|
|
private MultiplayerMatchSubScreen screen;
|
2020-12-20 15:04:06 +00:00
|
|
|
|
2020-12-25 04:38:11 +00:00
|
|
|
public TestSceneMultiplayerMatchSubScreen()
|
2020-12-20 15:04:06 +00:00
|
|
|
: base(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public new void Setup() => Schedule(() =>
|
|
|
|
{
|
|
|
|
Room.Name.Value = "Test Room";
|
|
|
|
});
|
|
|
|
|
|
|
|
[SetUpSteps]
|
|
|
|
public void SetupSteps()
|
|
|
|
{
|
2020-12-25 04:38:11 +00:00
|
|
|
AddStep("load match", () => LoadScreen(screen = new MultiplayerMatchSubScreen(Room)));
|
2020-12-20 15:04:06 +00:00
|
|
|
AddUntilStep("wait for load", () => screen.IsCurrentScreen());
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSettingValidity()
|
|
|
|
{
|
2020-12-25 04:38:11 +00:00
|
|
|
AddAssert("create button not enabled", () => !this.ChildrenOfType<MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>().Single().Enabled.Value);
|
2020-12-20 15:04:06 +00:00
|
|
|
|
|
|
|
AddStep("set playlist", () =>
|
|
|
|
{
|
|
|
|
Room.Playlist.Add(new PlaylistItem
|
|
|
|
{
|
|
|
|
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
|
|
Ruleset = { Value = new OsuRuleset().RulesetInfo },
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-12-25 04:38:11 +00:00
|
|
|
AddAssert("create button enabled", () => this.ChildrenOfType<MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>().Single().Enabled.Value);
|
2020-12-20 15:04:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestCreatedRoom()
|
|
|
|
{
|
|
|
|
AddStep("set playlist", () =>
|
|
|
|
{
|
|
|
|
Room.Playlist.Add(new PlaylistItem
|
|
|
|
{
|
|
|
|
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
|
|
Ruleset = { Value = new OsuRuleset().RulesetInfo },
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("click create button", () =>
|
|
|
|
{
|
2020-12-25 04:38:11 +00:00
|
|
|
InputManager.MoveMouseTo(this.ChildrenOfType<MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>().Single());
|
2020-12-20 15:04:06 +00:00
|
|
|
InputManager.Click(MouseButton.Left);
|
|
|
|
});
|
|
|
|
|
2020-12-21 09:42:55 +00:00
|
|
|
AddWaitStep("wait", 10);
|
2020-12-20 15:04:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|