Fix mania testcases

This commit is contained in:
smoogipoo 2018-05-14 11:33:23 +09:00
parent 6e1d651087
commit 8c86f170a9
2 changed files with 34 additions and 35 deletions

View File

@ -4,9 +4,10 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; 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;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -18,8 +19,13 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
public TestCaseManiaHitObjects() public TestCaseManiaHitObjects()
{ {
var hitWindows = new HitWindows(); Note note1 = new Note();
hitWindows.SetDifficulty(5); 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 Add(new FillFlowContainer
{ {
@ -47,14 +53,14 @@ namespace osu.Game.Rulesets.Mania.Tests
RelativeChildSize = new Vector2(1, 10000), RelativeChildSize = new Vector2(1, 10000),
Children = new[] Children = new[]
{ {
new DrawableNote(new Note { HitWindows = hitWindows }, ManiaAction.Key1) new DrawableNote(note1, ManiaAction.Key1)
{ {
Y = 5000, Y = 5000,
LifetimeStart = double.MinValue, LifetimeStart = double.MinValue,
LifetimeEnd = double.MaxValue, LifetimeEnd = double.MaxValue,
AccentColour = Color4.Red AccentColour = Color4.Red
}, },
new DrawableNote(new Note { HitWindows = hitWindows }, ManiaAction.Key1) new DrawableNote(note2, ManiaAction.Key1)
{ {
Y = 6000, Y = 6000,
LifetimeStart = double.MinValue, LifetimeStart = double.MinValue,
@ -81,11 +87,7 @@ namespace osu.Game.Rulesets.Mania.Tests
RelativeChildSize = new Vector2(1, 10000), RelativeChildSize = new Vector2(1, 10000),
Children = new[] Children = new[]
{ {
new DrawableHoldNote(new HoldNote new DrawableHoldNote(holdNote, ManiaAction.Key1)
{
Duration = 1000,
HitWindows = hitWindows
} , ManiaAction.Key1)
{ {
Y = 5000, Y = 5000,
Height = 1000, Height = 1000,

View File

@ -8,6 +8,8 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Configuration;
@ -83,13 +85,16 @@ namespace osu.Game.Rulesets.Mania.Tests
int col = rng.Next(0, 4); 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 AccentColour = playfield.Columns.ElementAt(col).AccentColour
}; };
playfield.OnJudgement(note, new ManiaJudgement { Result = HitResult.Perfect }); playfield.OnJudgement(drawableNote, new ManiaJudgement { Result = HitResult.Perfect });
playfield.Columns[col].OnJudgement(note, 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) for (double t = start_time; t <= start_time + duration; t += 100)
{ {
playfield.Add(new DrawableNote(new Note var note1 = new Note { StartTime = t, Column = 0 };
{ var note2 = new Note { StartTime = t, Column = 3 };
StartTime = t,
Column = 0
}, ManiaAction.Key1));
playfield.Add(new DrawableNote(new Note note1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
{ note2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
StartTime = t,
Column = 3 playfield.Add(new DrawableNote(note1, ManiaAction.Key1));
}, ManiaAction.Key4)); playfield.Add(new DrawableNote(note2, ManiaAction.Key4));
} }
playfield.Add(new DrawableHoldNote(new HoldNote var holdNote1 = new HoldNote { StartTime = start_time, Duration = duration, Column = 1 };
{ var holdNote2 = new HoldNote { StartTime = start_time, Duration = duration, Column = 2 };
StartTime = start_time,
Duration = duration,
Column = 1
}, ManiaAction.Key2));
playfield.Add(new DrawableHoldNote(new HoldNote holdNote1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
{ holdNote2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
StartTime = start_time,
Duration = duration, playfield.Add(new DrawableHoldNote(holdNote1, ManiaAction.Key2));
Column = 2 playfield.Add(new DrawableHoldNote(holdNote2, ManiaAction.Key3));
}, ManiaAction.Key3));
} }
} }
} }