mirror of
https://github.com/osukey/osukey.git
synced 2025-05-28 17:07:35 +09:00
Add failing test coverage for tournament startup states
This commit is contained in:
parent
69f5705ca0
commit
7fbeb9ecc7
@ -4,8 +4,10 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IPC;
|
||||
using osu.Game.Tournament.Screens.Gameplay;
|
||||
using osu.Game.Tournament.Screens.Gameplay.Components;
|
||||
|
||||
@ -16,16 +18,18 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
[Cached]
|
||||
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
[Test]
|
||||
public void TestStartupState([Values] TourneyState state)
|
||||
{
|
||||
Add(new GameplayScreen());
|
||||
Add(chat);
|
||||
AddStep("set state", () => IPCInfo.State.Value = state);
|
||||
createScreen();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWarmup()
|
||||
{
|
||||
createScreen();
|
||||
|
||||
checkScoreVisibility(false);
|
||||
|
||||
toggleWarmup();
|
||||
@ -35,6 +39,20 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
checkScoreVisibility(false);
|
||||
}
|
||||
|
||||
private void createScreen()
|
||||
{
|
||||
AddStep("setup screen", () =>
|
||||
{
|
||||
Remove(chat);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GameplayScreen(),
|
||||
chat,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void checkScoreVisibility(bool visible)
|
||||
=> AddUntilStep($"scores {(visible ? "shown" : "hidden")}",
|
||||
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user