1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Add more failing test coverage for null CurrentMatch

This commit is contained in:
Dean Herbert 2021-08-28 16:22:01 +09:00
parent e9b97f7937
commit 303c70791d
3 changed files with 20 additions and 5 deletions

View File

@ -25,6 +25,14 @@ namespace osu.Game.Tournament.Tests.Screens
createScreen();
}
[Test]
public void TestStartupStateNoCurrentMatch([Values] TourneyState state)
{
AddStep("set null current", () => Ladder.CurrentMatch.Value = null);
AddStep("set state", () => IPCInfo.State.Value = state);
createScreen();
}
[Test]
public void TestWarmup()
{

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Screens.TeamWin;
@ -10,8 +11,8 @@ namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneTeamWinScreen : TournamentTestScene
{
[BackgroundDependencyLoader]
private void load()
[Test]
public void TestBasic()
{
var match = Ladder.CurrentMatch.Value;

View File

@ -19,6 +19,8 @@ namespace osu.Game.Tournament.Tests
{
public abstract class TournamentTestScene : OsuTestScene
{
private TournamentMatch match;
[Cached]
protected LadderInfo Ladder { get; private set; } = new LadderInfo();
@ -33,19 +35,23 @@ namespace osu.Game.Tournament.Tests
{
Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First();
TournamentMatch match = CreateSampleMatch();
match = CreateSampleMatch();
Ladder.Rounds.Add(match.Round.Value);
Ladder.Matches.Add(match);
Ladder.Teams.Add(match.Team1.Value);
Ladder.Teams.Add(match.Team2.Value);
Ladder.CurrentMatch.Value = match;
Ruleset.BindTo(Ladder.Ruleset);
Dependencies.CacheAs(new StableInfo(storage));
}
[SetUpSteps]
public virtual void SetUpSteps()
{
AddStep("set current match", () => Ladder.CurrentMatch.Value = match);
}
public static TournamentMatch CreateSampleMatch() => new TournamentMatch
{
Team1 =