From 7c49843411c750565a3ab80f64b9dbd7233484ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Oct 2023 14:01:47 +0900 Subject: [PATCH] Fix various tests --- .../Mods/TestSceneManiaModDoubleTime.cs | 39 +++++++++++-------- .../TestSceneHoldNoteInput.cs | 18 ++++----- .../TestSceneMaximumScore.cs | 4 +- .../Rulesets/Scoring/ScoreProcessorTest.cs | 4 +- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModDoubleTime.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModDoubleTime.cs index 00b79529a9..9f2530eb31 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModDoubleTime.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModDoubleTime.cs @@ -17,12 +17,14 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods { private const double offset = 18; + protected override bool AllowFail => true; + protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset(); [Test] public void TestHitWindowWithoutDoubleTime() => CreateModTest(new ModTestData { - PassCondition = () => Player.ScoreProcessor.JudgedHits > 0 && Player.ScoreProcessor.Accuracy.Value != 1, + PassCondition = () => Player.ScoreProcessor.JudgedHits > 0 && Player.ScoreProcessor.Accuracy.Value == 1 && Player.ScoreProcessor.TotalScore.Value == 1_000_000, Autoplay = false, Beatmap = new Beatmap { @@ -40,24 +42,29 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods }); [Test] - public void TestHitWindowWithDoubleTime() => CreateModTest(new ModTestData + public void TestHitWindowWithDoubleTime() { - Mod = new ManiaModDoubleTime(), - PassCondition = () => Player.ScoreProcessor.JudgedHits > 0 && Player.ScoreProcessor.Accuracy.Value == 1, - Autoplay = false, - Beatmap = new Beatmap + var doubleTime = new ManiaModDoubleTime(); + + CreateModTest(new ModTestData { - BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, - Difficulty = { OverallDifficulty = 10 }, - HitObjects = new List + Mod = doubleTime, + PassCondition = () => Player.ScoreProcessor.JudgedHits > 0 && Player.ScoreProcessor.Accuracy.Value == 1 && Player.ScoreProcessor.TotalScore.Value / doubleTime.ScoreMultiplier == 100010, + Autoplay = false, + Beatmap = new Beatmap { - new Note { StartTime = 1000 } + BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, + Difficulty = { OverallDifficulty = 10 }, + HitObjects = new List + { + new Note { StartTime = 1000 } + }, }, - }, - ReplayFrames = new List - { - new ManiaReplayFrame(1000 + offset, ManiaAction.Key1) - } - }); + ReplayFrames = new List + { + new ManiaReplayFrame(1000 + offset, ManiaAction.Key1) + } + }); + } } } diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs index 93128c512f..ccd5e0600d 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs @@ -200,10 +200,12 @@ namespace osu.Game.Rulesets.Mania.Tests }); assertHeadJudgement(HitResult.Perfect); - assertComboAtJudgement(0, 1); + // judgement combo offset by perfect bonus judgement. see logic in DrawableNote.CheckForResult. + assertComboAtJudgement(1, 1); assertTailJudgement(HitResult.Meh); - assertComboAtJudgement(1, 0); - assertComboAtJudgement(2, 1); + assertComboAtJudgement(2, 0); + // judgement combo offset by perfect bonus judgement. see logic in DrawableNote.CheckForResult. + assertComboAtJudgement(4, 1); } /// @@ -392,13 +394,11 @@ namespace osu.Game.Rulesets.Mania.Tests Duration = time_tail - time_head, Column = 0, }, + // Next note within tail lenience + (ManiaHitObject)(note = new Note { - // Next note within tail lenience - note = new Note - { - StartTime = time_tail + 50 - } - } + StartTime = time_tail + 50 + }) }, BeatmapInfo = { diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneMaximumScore.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneMaximumScore.cs index 3d0abaceb5..3a74f87f1a 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneMaximumScore.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneMaximumScore.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Tests AddAssert("all objects perfectly judged", () => judgementResults.Select(result => result.Type), () => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult))); - AddAssert("score is 1 million", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000)); + AddAssert("score is correct", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_030)); } [Test] @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.Tests AddAssert("all objects perfectly judged", () => judgementResults.Select(result => result.Type), () => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult))); - AddAssert("score is 1 million", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000)); + AddAssert("base score is 1 million", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_040)); } private void performTest(List hitObjects, List frames) diff --git a/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs b/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs index 92e94bd02d..cba90b2ebe 100644 --- a/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs +++ b/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Rulesets.Scoring [TestCase(ScoringMode.Standardised, HitResult.Miss, HitResult.Great, 0)] [TestCase(ScoringMode.Standardised, HitResult.Meh, HitResult.Great, 79_333)] [TestCase(ScoringMode.Standardised, HitResult.Ok, HitResult.Great, 158_667)] - [TestCase(ScoringMode.Standardised, HitResult.Good, HitResult.Perfect, 302_402)] + [TestCase(ScoringMode.Standardised, HitResult.Good, HitResult.Perfect, 317_626)] [TestCase(ScoringMode.Standardised, HitResult.Great, HitResult.Great, 492_894)] [TestCase(ScoringMode.Standardised, HitResult.Perfect, HitResult.Perfect, 492_894)] [TestCase(ScoringMode.Standardised, HitResult.SmallTickMiss, HitResult.SmallTickHit, 0)] @@ -86,7 +86,7 @@ namespace osu.Game.Tests.Rulesets.Scoring [TestCase(ScoringMode.Classic, HitResult.Miss, HitResult.Great, 0)] [TestCase(ScoringMode.Classic, HitResult.Meh, HitResult.Great, 7_975)] [TestCase(ScoringMode.Classic, HitResult.Ok, HitResult.Great, 15_949)] - [TestCase(ScoringMode.Classic, HitResult.Good, HitResult.Perfect, 30_398)] + [TestCase(ScoringMode.Classic, HitResult.Good, HitResult.Perfect, 31_928)] [TestCase(ScoringMode.Classic, HitResult.Great, HitResult.Great, 49_546)] [TestCase(ScoringMode.Classic, HitResult.Perfect, HitResult.Perfect, 49_546)] [TestCase(ScoringMode.Classic, HitResult.SmallTickMiss, HitResult.SmallTickHit, 0)]