diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs index 3f1126d51..8dd60aaa9 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs @@ -49,7 +49,20 @@ public void TestHaveLyricButNoLanguage() } [Test] - public void TestHaveLyricAndLanguage() + public void TestEveryLyricContainsTranslate() + { + var translateLanguages = new List { new("Ja-jp") }; + var beatmap = createTestingBeatmap(translateLanguages, new[] + { + createLyric(new CultureInfo("Ja-jp"), "translate1"), + createLyric(new CultureInfo("Ja-jp"), "translate2"), + }); + + AssertOk(getContext(beatmap)); + } + + [Test] + public void TestCheckMissingTranslate() { // no lyric with translate string. (should have issue) var translateLanguages = new List { new("Ja-jp") }; @@ -75,39 +88,30 @@ public void TestHaveLyricAndLanguage() createLyric(new CultureInfo("Ja-jp"), string.Empty), }); AssertNotOk(getContext(beatmap3)); + } + [Test] + public void TestCheckMissingPartialTranslate() + { // some lyric with translate string. (should have issue) + var translateLanguages = new List { new("Ja-jp") }; var beatmap4 = createTestingBeatmap(translateLanguages, new[] { createLyric(new CultureInfo("Ja-jp"), "translate1"), createLyric(new CultureInfo("Ja-jp")), }); AssertNotOk(getContext(beatmap4)); + } - // every lyric with translate string. (should not have issue) - var beatmap5 = createTestingBeatmap(translateLanguages, new[] - { - createLyric(new CultureInfo("Ja-jp"), "translate1"), - createLyric(new CultureInfo("Ja-jp"), "translate2"), - }); - AssertOk(getContext(beatmap5)); - + [Test] + public void TestCheckContainsNotListedLanguage() + { // lyric translate not listed. (should have issue) var beatmap6 = createTestingBeatmap(null, new[] { createLyric(new CultureInfo("en-US"), "translate1"), }); AssertNotOk(getContext(beatmap6)); - - static Lyric createLyric(CultureInfo? cultureInfo = null, string translate = null!) - { - var lyric = new Lyric(); - if (cultureInfo == null) - return lyric; - - lyric.Translates.Add(cultureInfo, translate); - return lyric; - } } private static IBeatmap createTestingBeatmap(List? translateLanguage, IEnumerable? lyrics) @@ -126,4 +130,14 @@ private static IBeatmap createTestingBeatmap(List? translateLanguag private static BeatmapVerifierContext getContext(IBeatmap beatmap) => new(beatmap, new TestWorkingBeatmap(beatmap)); + + private static Lyric createLyric(CultureInfo? cultureInfo = null, string translate = null!) + { + var lyric = new Lyric(); + if (cultureInfo == null) + return lyric; + + lyric.Translates.Add(cultureInfo, translate); + return lyric; + } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapStageInfoTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapStageInfoTest.cs index a345cbaa1..fb1d46105 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapStageInfoTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapStageInfoTest.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Checks; -public class CheckBeatmapStageInfoTest : BeatmapPropertyCheckTest +public class CheckBeatmapStageInfoTest : BeatmapPropertyCheckTest { [Test] public void TestCheckNoElement() @@ -63,11 +63,11 @@ public void TestCheckMappingItemNotExist() AssertNotOk(getContext(beatmap)); } - public class TestCheckBeatmapStageInfo : CheckBeatmapStageInfo + public class CheckBeatmapStageInfo : CheckBeatmapStageInfo { protected override string Description => "Checks for testing the shared logic"; - public TestCheckBeatmapStageInfo() + public CheckBeatmapStageInfo() { // Note that we only test the lyric layout category. RegisterCategory(x => x.StyleCategory, 0);