1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 23:23:12 +08:00

Fix remaining test scenes

This commit is contained in:
Dean Herbert 2020-06-24 17:57:07 +09:00
parent eb3e1b2b26
commit 5fd6246d1b
2 changed files with 7 additions and 16 deletions

View File

@ -4,25 +4,19 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.TeamWin; using osu.Game.Tournament.Screens.TeamWin;
namespace osu.Game.Tournament.Tests.Screens namespace osu.Game.Tournament.Tests.Screens
{ {
public class TestSceneTeamWinScreen : TournamentTestScene public class TestSceneTeamWinScreen : TournamentTestScene
{ {
[Cached]
private readonly LadderInfo ladder = new LadderInfo();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var match = new TournamentMatch(); var match = Ladder.CurrentMatch.Value;
match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
match.Completed.Value = true; match.Completed.Value = true;
ladder.CurrentMatch.Value = match;
Add(new TeamWinScreen Add(new TeamWinScreen
{ {

View File

@ -31,14 +31,6 @@ namespace osu.Game.Tournament.Tests
{ {
Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First(); Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First();
Ruleset.BindTo(Ladder.Ruleset);
Dependencies.CacheAs(new StableInfo(storage));
}
protected override void LoadComplete()
{
base.LoadComplete();
TournamentMatch match = CreateSampleMatch(); TournamentMatch match = CreateSampleMatch();
Ladder.Rounds.Add(match.Round.Value); Ladder.Rounds.Add(match.Round.Value);
@ -47,6 +39,9 @@ namespace osu.Game.Tournament.Tests
Ladder.Teams.Add(match.Team2.Value); Ladder.Teams.Add(match.Team2.Value);
Ladder.CurrentMatch.Value = match; Ladder.CurrentMatch.Value = match;
Ruleset.BindTo(Ladder.Ruleset);
Dependencies.CacheAs(new StableInfo(storage));
} }
public static TournamentMatch CreateSampleMatch() => new TournamentMatch public static TournamentMatch CreateSampleMatch() => new TournamentMatch
@ -55,6 +50,7 @@ namespace osu.Game.Tournament.Tests
{ {
Value = new TournamentTeam Value = new TournamentTeam
{ {
Acronym = { Value = "JPN" },
FlagName = { Value = "JP" }, FlagName = { Value = "JP" },
FullName = { Value = "Japan" }, FullName = { Value = "Japan" },
LastYearPlacing = { Value = 10 }, LastYearPlacing = { Value = 10 },
@ -128,6 +124,7 @@ namespace osu.Game.Tournament.Tests
{ {
Value = new TournamentTeam Value = new TournamentTeam
{ {
Acronym = { Value = "USA" },
FlagName = { Value = "US" }, FlagName = { Value = "US" },
FullName = { Value = "United States" }, FullName = { Value = "United States" },
Players = Players =