Add a catch specific player test

This commit is contained in:
Dean Herbert 2017-09-19 21:40:57 +09:00
parent 0aa152974a
commit f96875a470
3 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,20 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestCaseCatchPlayer : Game.Tests.Visual.TestCasePlayer
{
protected override Beatmap CreateBeatmap()
{
var beatmap = new Beatmap();
for (int i = 0; i < 256; i++)
beatmap.HitObjects.Add(new Fruit { X = 0.5f, StartTime = i * 100, NewCombo = i % 8 == 0 });
return beatmap;
}
}
}

View File

@ -58,6 +58,7 @@
<Compile Include="Objects\Fruit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tests\TestCaseCatcher.cs" />
<Compile Include="Tests\TestCaseCatchPlayer.cs" />
<Compile Include="UI\CatcherArea.cs" />
<Compile Include="UI\CatchRulesetContainer.cs" />
<Compile Include="UI\CatchPlayfield.cs" />

View File

@ -16,7 +16,7 @@
namespace osu.Game.Tests.Visual
{
internal class TestCasePlayer : OsuTestCase
public class TestCasePlayer : OsuTestCase
{
protected Player Player;
private RulesetStore rulesets;
@ -45,7 +45,7 @@ protected override void LoadComplete()
loadPlayerFor(rulesets.Query<RulesetInfo>().First());
}
private void loadPlayerFor(RulesetInfo r)
protected virtual Beatmap CreateBeatmap()
{
Beatmap beatmap;
@ -53,6 +53,13 @@ private void loadPlayerFor(RulesetInfo r)
using (var reader = new StreamReader(stream))
beatmap = BeatmapDecoder.GetDecoder(reader).Decode(reader);
return beatmap;
}
private void loadPlayerFor(RulesetInfo r)
{
var beatmap = CreateBeatmap();
beatmap.BeatmapInfo.Ruleset = r;
var instance = r.CreateInstance();