From f96875a470e53cdd0480b84ea3ca724887cbc6a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Sep 2017 21:40:57 +0900 Subject: [PATCH] Add a catch specific player test --- .../Tests/TestCaseCatchPlayer.cs | 20 +++++++++++++++++++ .../osu.Game.Rulesets.Catch.csproj | 1 + osu.Game/Tests/Visual/TestCasePlayer.cs | 11 ++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Tests/TestCaseCatchPlayer.cs diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseCatchPlayer.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseCatchPlayer.cs new file mode 100644 index 0000000000..55e6d8d226 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseCatchPlayer.cs @@ -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; + } + } +} diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 43124e4146..323a934e27 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -58,6 +58,7 @@ + diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 49146c4173..4a25a52e36 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -16,7 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Tests.Visual { - internal class TestCasePlayer : OsuTestCase + public class TestCasePlayer : OsuTestCase { protected Player Player; private RulesetStore rulesets; @@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual loadPlayerFor(rulesets.Query().First()); } - private void loadPlayerFor(RulesetInfo r) + protected virtual Beatmap CreateBeatmap() { Beatmap beatmap; @@ -53,6 +53,13 @@ namespace osu.Game.Tests.Visual 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();