2019-03-04 04:24:19 +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.
|
2018-11-06 10:23:03 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-04-03 19:45:11 +00:00
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
2018-11-06 10:23:03 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-08-28 05:15:47 +00:00
|
|
|
using osu.Framework.Graphics;
|
2021-04-03 19:45:11 +00:00
|
|
|
using osu.Framework.Testing;
|
2019-06-14 07:57:29 +00:00
|
|
|
using osu.Game.Tournament.Components;
|
2021-08-28 05:15:47 +00:00
|
|
|
using osu.Game.Tournament.IPC;
|
2018-11-06 10:23:03 +00:00
|
|
|
using osu.Game.Tournament.Screens.Gameplay;
|
2021-04-03 19:45:11 +00:00
|
|
|
using osu.Game.Tournament.Screens.Gameplay.Components;
|
2018-11-06 10:23:03 +00:00
|
|
|
|
2019-06-18 06:28:36 +00:00
|
|
|
namespace osu.Game.Tournament.Tests.Screens
|
2018-11-06 10:23:03 +00:00
|
|
|
{
|
2019-07-29 22:23:25 +00:00
|
|
|
public partial class TestSceneGameplayScreen : TournamentTestScene
|
2018-11-06 10:23:03 +00:00
|
|
|
{
|
2019-06-14 07:57:29 +00:00
|
|
|
[Cached]
|
2020-03-08 08:43:55 +00:00
|
|
|
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f };
|
2018-11-06 10:23:03 +00:00
|
|
|
|
2021-08-28 05:15:47 +00:00
|
|
|
[Test]
|
|
|
|
public void TestStartupState([Values] TourneyState state)
|
2018-11-06 10:23:03 +00:00
|
|
|
{
|
2021-08-28 05:15:47 +00:00
|
|
|
AddStep("set state", () => IPCInfo.State.Value = state);
|
2021-08-28 07:22:01 +00:00
|
|
|
createScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestStartupStateNoCurrentMatch([Values] TourneyState state)
|
|
|
|
{
|
|
|
|
AddStep("set null current", () => Ladder.CurrentMatch.Value = null);
|
|
|
|
AddStep("set state", () => IPCInfo.State.Value = state);
|
2021-08-28 05:15:47 +00:00
|
|
|
createScreen();
|
2018-11-06 10:23:03 +00:00
|
|
|
}
|
2021-04-03 19:45:11 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestWarmup()
|
|
|
|
{
|
2021-08-28 05:15:47 +00:00
|
|
|
createScreen();
|
|
|
|
|
2021-04-03 19:45:11 +00:00
|
|
|
checkScoreVisibility(false);
|
|
|
|
|
|
|
|
toggleWarmup();
|
|
|
|
checkScoreVisibility(true);
|
|
|
|
|
|
|
|
toggleWarmup();
|
|
|
|
checkScoreVisibility(false);
|
|
|
|
}
|
|
|
|
|
2021-08-28 05:15:47 +00:00
|
|
|
private void createScreen()
|
|
|
|
{
|
|
|
|
AddStep("setup screen", () =>
|
|
|
|
{
|
2022-08-26 06:19:05 +00:00
|
|
|
Remove(chat, false);
|
2021-08-28 05:15:47 +00:00
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new GameplayScreen(),
|
|
|
|
chat,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-03 19:45:11 +00: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 08:27:44 +00:00
|
|
|
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().TriggerClick());
|
2018-11-06 10:23:03 +00:00
|
|
|
}
|
|
|
|
}
|