From 8c86f170a928404e63800d552179fff236bb10e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 14 May 2018 11:33:23 +0900 Subject: [PATCH] Fix mania testcases --- .../TestCaseManiaHitObjects.cs | 22 +++++---- .../TestCaseManiaPlayfield.cs | 47 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseManiaHitObjects.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseManiaHitObjects.cs index dd81d015f1..a4109722d4 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseManiaHitObjects.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseManiaHitObjects.cs @@ -4,9 +4,10 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; -using osu.Game.Rulesets.Objects; using osu.Game.Tests.Visual; using OpenTK; using OpenTK.Graphics; @@ -18,8 +19,13 @@ namespace osu.Game.Rulesets.Mania.Tests { public TestCaseManiaHitObjects() { - var hitWindows = new HitWindows(); - hitWindows.SetDifficulty(5); + Note note1 = new Note(); + Note note2 = new Note(); + HoldNote holdNote = new HoldNote { StartTime = 1000 }; + + note1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + note2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); Add(new FillFlowContainer { @@ -47,14 +53,14 @@ namespace osu.Game.Rulesets.Mania.Tests RelativeChildSize = new Vector2(1, 10000), Children = new[] { - new DrawableNote(new Note { HitWindows = hitWindows }, ManiaAction.Key1) + new DrawableNote(note1, ManiaAction.Key1) { Y = 5000, LifetimeStart = double.MinValue, LifetimeEnd = double.MaxValue, AccentColour = Color4.Red }, - new DrawableNote(new Note { HitWindows = hitWindows }, ManiaAction.Key1) + new DrawableNote(note2, ManiaAction.Key1) { Y = 6000, LifetimeStart = double.MinValue, @@ -81,11 +87,7 @@ namespace osu.Game.Rulesets.Mania.Tests RelativeChildSize = new Vector2(1, 10000), Children = new[] { - new DrawableHoldNote(new HoldNote - { - Duration = 1000, - HitWindows = hitWindows - } , ManiaAction.Key1) + new DrawableHoldNote(holdNote, ManiaAction.Key1) { Y = 5000, Height = 1000, diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseManiaPlayfield.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseManiaPlayfield.cs index 053f478027..dff2b2d56a 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseManiaPlayfield.cs @@ -8,6 +8,8 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Configuration; @@ -83,13 +85,16 @@ namespace osu.Game.Rulesets.Mania.Tests int col = rng.Next(0, 4); - var note = new DrawableNote(new Note { Column = col }, ManiaAction.Key1) + var note = new Note { Column = col }; + note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + var drawableNote = new DrawableNote(note, ManiaAction.Key1) { AccentColour = playfield.Columns.ElementAt(col).AccentColour }; - playfield.OnJudgement(note, new ManiaJudgement { Result = HitResult.Perfect }); - playfield.Columns[col].OnJudgement(note, new ManiaJudgement { Result = HitResult.Perfect }); + playfield.OnJudgement(drawableNote, new ManiaJudgement { Result = HitResult.Perfect }); + playfield.Columns[col].OnJudgement(drawableNote, new ManiaJudgement { Result = HitResult.Perfect }); }); } @@ -162,32 +167,24 @@ namespace osu.Game.Rulesets.Mania.Tests for (double t = start_time; t <= start_time + duration; t += 100) { - playfield.Add(new DrawableNote(new Note - { - StartTime = t, - Column = 0 - }, ManiaAction.Key1)); + var note1 = new Note { StartTime = t, Column = 0 }; + var note2 = new Note { StartTime = t, Column = 3 }; - playfield.Add(new DrawableNote(new Note - { - StartTime = t, - Column = 3 - }, ManiaAction.Key4)); + note1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + note2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + playfield.Add(new DrawableNote(note1, ManiaAction.Key1)); + playfield.Add(new DrawableNote(note2, ManiaAction.Key4)); } - playfield.Add(new DrawableHoldNote(new HoldNote - { - StartTime = start_time, - Duration = duration, - Column = 1 - }, ManiaAction.Key2)); + var holdNote1 = new HoldNote { StartTime = start_time, Duration = duration, Column = 1 }; + var holdNote2 = new HoldNote { StartTime = start_time, Duration = duration, Column = 2 }; - playfield.Add(new DrawableHoldNote(new HoldNote - { - StartTime = start_time, - Duration = duration, - Column = 2 - }, ManiaAction.Key3)); + holdNote1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + holdNote2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + playfield.Add(new DrawableHoldNote(holdNote1, ManiaAction.Key2)); + playfield.Add(new DrawableHoldNote(holdNote2, ManiaAction.Key3)); } } }