1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Make test case add test drawings file.

This commit is contained in:
smoogipooo 2017-03-03 16:33:40 +09:00
parent 1d1c08125b
commit 7cac2680b1
2 changed files with 30 additions and 4 deletions

View File

@ -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();

View File

@ -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)