1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 16:52:57 +08:00
osu-lazer/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs

72 lines
2.1 KiB
C#
Raw Normal View History

2019-03-04 12:24:19 +08: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.
2018-11-06 18:23:03 +08:00
2021-04-04 03:45:11 +08:00
using System.Linq;
using NUnit.Framework;
2018-11-06 18:23:03 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2021-04-04 03:45:11 +08:00
using osu.Framework.Testing;
2019-06-14 15:57:29 +08:00
using osu.Game.Tournament.Components;
using osu.Game.Tournament.IPC;
2018-11-06 18:23:03 +08:00
using osu.Game.Tournament.Screens.Gameplay;
2021-04-04 03:45:11 +08:00
using osu.Game.Tournament.Screens.Gameplay.Components;
2018-11-06 18:23:03 +08:00
2019-06-18 14:28:36 +08:00
namespace osu.Game.Tournament.Tests.Screens
2018-11-06 18:23:03 +08:00
{
public partial class TestSceneGameplayScreen : TournamentScreenTestScene
2018-11-06 18:23:03 +08:00
{
2019-06-14 15:57:29 +08:00
[Cached]
2020-03-08 16:43:55 +08:00
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f };
2018-11-06 18:23:03 +08:00
[Test]
public void TestWarmup()
2018-11-06 18:23:03 +08:00
{
createScreen();
checkScoreVisibility(false);
toggleWarmup();
checkScoreVisibility(true);
toggleWarmup();
checkScoreVisibility(false);
}
[Test]
public void TestStartupState([Values] TourneyState state)
{
AddStep("set state", () => IPCInfo.State.Value = state);
createScreen();
2018-11-06 18:23:03 +08:00
}
2021-04-04 03:45:11 +08:00
[Test]
public void TestStartupStateNoCurrentMatch([Values] TourneyState state)
2021-04-04 03:45:11 +08:00
{
AddStep("set null current", () => Ladder.CurrentMatch.Value = null);
AddStep("set state", () => IPCInfo.State.Value = state);
createScreen();
2021-04-04 03:45:11 +08:00
}
private void createScreen()
{
AddStep("setup screen", () =>
{
Remove(chat, false);
Children = new Drawable[]
{
new GameplayScreen(),
chat,
};
});
}
2021-04-04 03:45:11 +08:00
private void checkScoreVisibility(bool visible)
=> AddUntilStep($"scores {(visible ? "shown" : "hidden")}",
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
private void toggleWarmup()
2021-08-04 16:27:44 +08:00
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().TriggerClick());
2018-11-06 18:23:03 +08:00
}
}