mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 17:53:21 +08:00
Make test case add test drawings file.
This commit is contained in:
parent
1d1c08125b
commit
7cac2680b1
@ -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 osu.Game.Screens.Tournament;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -13,6 +16,29 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
public override string Name => @"Drawings";
|
public override string Name => @"Drawings";
|
||||||
public override string Description => "Tournament 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()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
@ -30,8 +30,8 @@ namespace osu.Game.Screens.Tournament
|
|||||||
{
|
{
|
||||||
public class Drawings : OsuScreen
|
public class Drawings : OsuScreen
|
||||||
{
|
{
|
||||||
|
public const string TEAMS_FILENAME = "drawings.txt";
|
||||||
private const string results_filename = "drawings_results.txt";
|
private const string results_filename = "drawings_results.txt";
|
||||||
private const string teams_filename = "drawings.txt";
|
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||||
internal override bool ShowOverlays => false;
|
internal override bool ShowOverlays => false;
|
||||||
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
{
|
{
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
if (!storage.Exists(teams_filename))
|
if (!storage.Exists(TEAMS_FILENAME))
|
||||||
{
|
{
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
@ -281,7 +281,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
try
|
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))
|
using (StreamReader sr = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
while (sr.Peek() != -1)
|
while (sr.Peek() != -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user