mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 08:27:49 +08:00
Add tests for all taiko judgements
This commit is contained in:
parent
a2f8ff825e
commit
2ca63b5030
96
osu.Game.Rulesets.Taiko.Tests/Judgements/JudgementTest.cs
Normal file
96
osu.Game.Rulesets.Taiko.Tests/Judgements/JudgementTest.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
|
{
|
||||||
|
public class JudgementTest : RateAdjustedBeatmapTestScene
|
||||||
|
{
|
||||||
|
private ScoreAccessibleReplayPlayer currentPlayer = null!;
|
||||||
|
protected List<JudgementResult> JudgementResults { get; private set; } = null!;
|
||||||
|
|
||||||
|
protected void AssertJudgementCount(int count)
|
||||||
|
{
|
||||||
|
AddAssert($"{count} judgement{(count > 0 ? "s" : "")}", () => JudgementResults, () => Has.Count.EqualTo(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AssertResult<T>(int index, HitResult expectedResult)
|
||||||
|
{
|
||||||
|
AddAssert($"{typeof(T).ReadableName()} ({index}) judged as {expectedResult}",
|
||||||
|
() => JudgementResults.Where(j => j.HitObject is T).OrderBy(j => j.HitObject.StartTime).ElementAt(index).Type,
|
||||||
|
() => Is.EqualTo(expectedResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PerformTest(List<ReplayFrame> frames, Beatmap<TaikoHitObject>? beatmap = null)
|
||||||
|
{
|
||||||
|
AddStep("load player", () =>
|
||||||
|
{
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
||||||
|
|
||||||
|
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
|
||||||
|
|
||||||
|
p.OnLoadComplete += _ =>
|
||||||
|
{
|
||||||
|
p.ScoreProcessor.NewJudgement += result =>
|
||||||
|
{
|
||||||
|
if (currentPlayer == p) JudgementResults.Add(result);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
LoadScreen(currentPlayer = p);
|
||||||
|
JudgementResults = new List<JudgementResult>();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
|
||||||
|
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
|
||||||
|
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Beatmap<TaikoHitObject> CreateBeatmap(params TaikoHitObject[] hitObjects)
|
||||||
|
{
|
||||||
|
var beatmap = new Beatmap<TaikoHitObject>
|
||||||
|
{
|
||||||
|
HitObjects = hitObjects.ToList(),
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Difficulty = new BeatmapDifficulty { SliderTickRate = 4 },
|
||||||
|
Ruleset = new TaikoRuleset().RulesetInfo
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f });
|
||||||
|
return beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||||
|
{
|
||||||
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
|
||||||
|
protected override bool PauseOnFocusLost => false;
|
||||||
|
|
||||||
|
public ScoreAccessibleReplayPlayer(Score score)
|
||||||
|
: base(score, new PlayerConfiguration
|
||||||
|
{
|
||||||
|
AllowPause = false,
|
||||||
|
ShowResults = false,
|
||||||
|
})
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,201 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||||
|
{
|
||||||
|
public class TestSceneDrumRollJudgements : JudgementTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestHitAllDrumRoll()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1001),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(3);
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitSomeDrumRoll()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(3);
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitNoneDrumRoll()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(3);
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.IgnoreMiss);
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitAllStrongDrumRollWithOneKey()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1001),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(6);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitSomeStrongDrumRollWithOneKey()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(6);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitAllStrongDrumRollWithBothKeys()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||||
|
new TaikoReplayFrame(1001),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(6);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitSomeStrongDrumRollWithBothKeys()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
}, CreateBeatmap(new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(6);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||||
|
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||||
|
|
||||||
|
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||||
|
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||||
|
{
|
||||||
|
public class TestSceneHitJudgements : JudgementTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestHitCentreHit()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre),
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Centre,
|
||||||
|
StartTime = hit_time
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(1);
|
||||||
|
AssertResult<Hit>(0, HitResult.Great);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitRimHit()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(hit_time, TaikoAction.LeftRim),
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Rim,
|
||||||
|
StartTime = hit_time
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(1);
|
||||||
|
AssertResult<Hit>(0, HitResult.Great);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMissHit()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0)
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Centre,
|
||||||
|
StartTime = hit_time
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(1);
|
||||||
|
AssertResult<Hit>(0, HitResult.Miss);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitStrongHitWithOneKey()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre),
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Centre,
|
||||||
|
StartTime = hit_time,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(2);
|
||||||
|
AssertResult<Hit>(0, HitResult.Great);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitStrongHitWithBothKeys()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Centre,
|
||||||
|
StartTime = hit_time,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(2);
|
||||||
|
AssertResult<Hit>(0, HitResult.Great);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMissStrongHit()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
PerformTest(new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
}, CreateBeatmap(new Hit
|
||||||
|
{
|
||||||
|
Type = HitType.Centre,
|
||||||
|
StartTime = hit_time,
|
||||||
|
IsStrong = true
|
||||||
|
}));
|
||||||
|
|
||||||
|
AssertJudgementCount(2);
|
||||||
|
AssertResult<Hit>(0, HitResult.Miss);
|
||||||
|
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||||
|
{
|
||||||
|
public class TestSceneSwellJudgements : JudgementTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestHitAllSwell()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
Swell swell = new Swell
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
RequiredHits = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits; i++)
|
||||||
|
{
|
||||||
|
double frameTime = 1000 + i * 50;
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime, i % 2 == 0 ? TaikoAction.LeftCentre : TaikoAction.LeftRim));
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime + 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformTest(frames, CreateBeatmap(swell));
|
||||||
|
|
||||||
|
AssertJudgementCount(11);
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits; i++)
|
||||||
|
AssertResult<SwellTick>(i, HitResult.IgnoreHit);
|
||||||
|
|
||||||
|
AssertResult<Swell>(0, HitResult.LargeBonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitSomeSwell()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
Swell swell = new Swell
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
RequiredHits = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits / 2; i++)
|
||||||
|
{
|
||||||
|
double frameTime = 1000 + i * 50;
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime, i % 2 == 0 ? TaikoAction.LeftCentre : TaikoAction.LeftRim));
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime + 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformTest(frames, CreateBeatmap(swell));
|
||||||
|
|
||||||
|
AssertJudgementCount(11);
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits / 2; i++)
|
||||||
|
AssertResult<SwellTick>(i, HitResult.IgnoreHit);
|
||||||
|
for (int i = swell.RequiredHits / 2; i < swell.RequiredHits; i++)
|
||||||
|
AssertResult<SwellTick>(i, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitNoneSwell()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
Swell swell = new Swell
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
RequiredHits = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
};
|
||||||
|
|
||||||
|
PerformTest(frames, CreateBeatmap(swell));
|
||||||
|
|
||||||
|
AssertJudgementCount(11);
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits; i++)
|
||||||
|
AssertResult<SwellTick>(i, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AddAssert("all tick offsets are 0", () => JudgementResults.Where(r => r.HitObject is SwellTick).All(r => r.TimeOffset == 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests
|
|
||||||
{
|
|
||||||
public class TestSceneSwellJudgements : TestSceneTaikoPlayer
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void TestZeroTickTimeOffsets()
|
|
||||||
{
|
|
||||||
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted.Value);
|
|
||||||
AddAssert("all tick offsets are 0", () => Player.Results.Where(r => r.HitObject is SwellTick).All(r => r.TimeOffset == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool Autoplay => true;
|
|
||||||
|
|
||||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
|
||||||
{
|
|
||||||
var beatmap = new Beatmap<TaikoHitObject>
|
|
||||||
{
|
|
||||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo },
|
|
||||||
HitObjects =
|
|
||||||
{
|
|
||||||
new Swell
|
|
||||||
{
|
|
||||||
StartTime = 1000,
|
|
||||||
Duration = 1000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return beatmap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user