From 7cac2680b15e381b8b45a1bc4db03d4b67d6b639 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 3 Mar 2017 16:33:40 +0900 Subject: [PATCH] Make test case add test drawings file. --- .../Tests/TestCaseDrawings.cs | 28 ++++++++++++++++++- osu.Game/Screens/Tournament/Drawings.cs | 6 ++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index 039d522084..c52a8a7d8c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -1,7 +1,10 @@ -using osu.Framework.Screens.Testing; +using osu.Framework.Allocation; +using osu.Framework.Platform; +using osu.Framework.Screens.Testing; using osu.Game.Screens.Tournament; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -13,6 +16,29 @@ namespace osu.Desktop.VisualTests.Tests public override string Name => @"Drawings"; public override string Description => "Tournament drawings"; + [BackgroundDependencyLoader] + private void load(Storage storage) + { + string[] testTeams = + { + "GB:United Kingdom:UK", + "FR:France:FRA", + "CN:China:CHN", + "AU:Australia:AUS", + "JP:Japan:JPN", + "RO:Romania", + "IT:Italy", + "VE:Venezuela:VNZ" + }; + + using (Stream stream = storage.GetStream(Drawings.TEAMS_FILENAME, FileAccess.Write, FileMode.Create)) + using (StreamWriter sw = new StreamWriter(stream)) + { + foreach (string line in testTeams) + sw.WriteLine(line); + } + } + public override void Reset() { base.Reset(); diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index d2fbf6c432..371cd537b0 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -30,8 +30,8 @@ namespace osu.Game.Screens.Tournament { public class Drawings : OsuScreen { + public const string TEAMS_FILENAME = "drawings.txt"; private const string results_filename = "drawings_results.txt"; - private const string teams_filename = "drawings.txt"; protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); internal override bool ShowOverlays => false; @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament { this.storage = storage; - if (!storage.Exists(teams_filename)) + if (!storage.Exists(TEAMS_FILENAME)) { Exit(); return; @@ -281,7 +281,7 @@ namespace osu.Game.Screens.Tournament try { - using (Stream stream = storage.GetStream(teams_filename, FileAccess.Read, FileMode.Open)) + using (Stream stream = storage.GetStream(TEAMS_FILENAME, FileAccess.Read, FileMode.Open)) using (StreamReader sr = new StreamReader(stream)) { while (sr.Peek() != -1)