diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/BaseGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/BaseGeneratorTest.cs new file mode 100644 index 000000000..40eebeb08 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/BaseGeneratorTest.cs @@ -0,0 +1,24 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Rulesets.Karaoke.Edit.Generator; + +namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator; + +public class BaseGeneratorTest where TConfig : IHasConfig, new() +{ + protected static TConfig GeneratorConfig(Action? action = null) + { + var config = new TConfig(); + action?.Invoke(config); + return config; + } + + protected static TConfig GeneratorDefaultConfig(Action? action = null) + { + var config = new TConfig().CreateDefaultConfig(); + action?.Invoke(config); + return config; + } +} diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapDetectorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapDetectorTest.cs index c8941ecb6..7eace9cd4 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapDetectorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapDetectorTest.cs @@ -4,32 +4,15 @@ using System; using NUnit.Framework; using osu.Game.Rulesets.Karaoke.Beatmaps; +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Beatmaps; namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Beatmaps { public abstract class BaseBeatmapDetectorTest - where TDetector : class, IBeatmapPropertyDetector where TConfig : new() + : BaseGeneratorTest + where TDetector : class, IBeatmapPropertyDetector where TConfig : IHasConfig, new() { - protected static TConfig GeneratorConfig(params string?[] properties) - { - var config = new TConfig(); - - foreach (string? propertyName in properties) - { - if (propertyName == null) - continue; - - var theMethod = config.GetType().GetProperty(propertyName); - if (theMethod == null) - throw new MissingMethodException("Config is not exist."); - - theMethod.SetValue(config, true); - } - - return config; - } - protected static TDetector GenerateDetector(TConfig config) { if (Activator.CreateInstance(typeof(TDetector), config) is not TDetector detector) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapGeneratorTest.cs index 76be357ac..e4a7cd96e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/BaseBeatmapGeneratorTest.cs @@ -10,15 +10,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Beatmaps { public abstract class BaseBeatmapGeneratorTest + : BaseGeneratorTest where TGenerator : class, IBeatmapPropertyGenerator where TConfig : IHasConfig, new() { - protected static TConfig GeneratorConfig(Action? action = null) - { - var config = new TConfig().CreateDefaultConfig(); - action?.Invoke(config); - return config; - } - protected static TGenerator GenerateGenerator(TConfig config) { if (Activator.CreateInstance(typeof(TGenerator), config) is not TGenerator generator) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/Pages/PageGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/Pages/PageGeneratorTest.cs index 99dedebd6..efc0da9f3 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/Pages/PageGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Beatmaps/Pages/PageGeneratorTest.cs @@ -26,7 +26,7 @@ public class PageGeneratorTest : BaseBeatmapGeneratorTest().ToList(), @@ -38,7 +38,7 @@ public void TestCanGenerate(string[] lyrics, bool canGenerate) [Test] public void TestGenerateWithZeroLyric() { - var config = GeneratorConfig(); + var config = GeneratorDefaultConfig(); var beatmap = new KaraokeBeatmap { HitObjects = new List() @@ -53,7 +53,7 @@ public void TestGenerateWithZeroLyric() [TestCase("[1000,23000]:karaoke", new[] { 1000, 1000 + max_interval, 1000 + max_interval * 2, 23000 })] public void TestGenerateWithSingleLyric(string lyric, double[] expectedTimes) { - var config = GeneratorConfig(); + var config = GeneratorDefaultConfig(); var beatmap = new KaraokeBeatmap { HitObjects = new List @@ -77,7 +77,7 @@ public void TestGenerateWithSingleLyric(string lyric, double[] expectedTimes) [TestCase("[1000,23000]:karaoke", "[3000,4000]:karaoke", new[] { 1000, 1000 + max_interval, 1000 + max_interval * 2, 23000 })] // should ignore second lyric. public void TestGenerateWithTwoLyrics(string firstLyric, string secondLyric, double[] expectedTimes) { - var config = GeneratorConfig(); + var config = GeneratorDefaultConfig(); var beatmap = new KaraokeBeatmap { HitObjects = new List diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricDetectorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricDetectorTest.cs index e9a65eb97..8949b36cc 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricDetectorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricDetectorTest.cs @@ -3,33 +3,16 @@ using System; using NUnit.Framework; +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics; using osu.Game.Rulesets.Karaoke.Objects; namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics { public abstract class BaseLyricDetectorTest - where TDetector : class, ILyricPropertyDetector where TConfig : new() + : BaseGeneratorTest + where TDetector : class, ILyricPropertyDetector where TConfig : IHasConfig, new() { - protected static TConfig GeneratorConfig(params string?[] properties) - { - var config = new TConfig(); - - foreach (string? propertyName in properties) - { - if (propertyName == null) - continue; - - var theMethod = config.GetType().GetProperty(propertyName); - if (theMethod == null) - throw new MissingMethodException("Config is not exist."); - - theMethod.SetValue(config, true); - } - - return config; - } - protected static TDetector GenerateDetector(TConfig config) { if (Activator.CreateInstance(typeof(TDetector), config) is not TDetector detector) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricGeneratorTest.cs index 1b5539d8e..2323e109c 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/BaseLyricGeneratorTest.cs @@ -3,33 +3,16 @@ using System; using NUnit.Framework; +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics; using osu.Game.Rulesets.Karaoke.Objects; namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics { public abstract class BaseLyricGeneratorTest - where TGenerator : class, ILyricPropertyGenerator where TConfig : new() + : BaseGeneratorTest + where TGenerator : class, ILyricPropertyGenerator where TConfig : IHasConfig, new() { - protected static TConfig GeneratorConfig(params string?[] properties) - { - var config = new TConfig(); - - foreach (string? propertyName in properties) - { - if (propertyName == null) - continue; - - var theMethod = config.GetType().GetProperty(propertyName); - if (theMethod == null) - throw new MissingMethodException("Config is not exist."); - - theMethod.SetValue(config, true); - } - - return config; - } - protected static TGenerator GenerateGenerator(TConfig config) { if (Activator.CreateInstance(typeof(TGenerator), config) is not TGenerator generator) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/ReferenceLyric/ReferenceLyricDetectorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/ReferenceLyric/ReferenceLyricDetectorTest.cs index 1941874f0..5379e8010 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/ReferenceLyric/ReferenceLyricDetectorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/ReferenceLyric/ReferenceLyricDetectorTest.cs @@ -59,7 +59,7 @@ public void TestCanDetectWithIgnorePrefixAndPostfixSymbol(string lyricText, stri }, detectedLyric }; - var config = GeneratorConfig("IgnorePrefixAndPostfixSymbol"); + var config = GeneratorConfig(x => x.IgnorePrefixAndPostfixSymbol = true); CheckCanDetect(lyrics, detectedLyric, canDetect, config); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/BaseRomajiTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/BaseRomajiTagGeneratorTest.cs index d84868339..832fdf131 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/BaseRomajiTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/BaseRomajiTagGeneratorTest.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.RomajiTags; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Tests.Asserts; @@ -9,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics.RomajiTags { public abstract class BaseRomajiTagGeneratorTest : BaseLyricGeneratorTest - where TRomajiTagGenerator : RomajiTagGenerator where TConfig : RomajiTagGeneratorConfig, new() + where TRomajiTagGenerator : RomajiTagGenerator where TConfig : RomajiTagGeneratorConfig, IHasConfig, new() { protected static void CheckCanGenerate(string text, bool canGenerate, TConfig config) { diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/Ja/JaRomajiTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/Ja/JaRomajiTagGeneratorTest.cs index 2826779f5..0dfcdd1a8 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/Ja/JaRomajiTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RomajiTags/Ja/JaRomajiTagGeneratorTest.cs @@ -31,7 +31,7 @@ public void TestGenerate(string text, string[] expectedRomajies) [TestCase("はなび", new[] { "[0,3]:HANABI" })] public void TestGenerateWithUppercase(string text, string[] expectedRomajies) { - var config = GeneratorConfig(nameof(JaRomajiTagGeneratorConfig.Uppercase)); + var config = GeneratorConfig(x => x.Uppercase = true); CheckGenerateResult(text, expectedRomajies, config); } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/BaseRubyTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/BaseRubyTagGeneratorTest.cs index a9a5e4183..154e0dcf1 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/BaseRubyTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/BaseRubyTagGeneratorTest.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.RubyTags; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Tests.Asserts; @@ -9,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics.RubyTags { public abstract class BaseRubyTagGeneratorTest : BaseLyricGeneratorTest - where TRubyTagGenerator : RubyTagGenerator where TConfig : RubyTagGeneratorConfig, new() + where TRubyTagGenerator : RubyTagGenerator where TConfig : RubyTagGeneratorConfig, IHasConfig, new() { protected static void CheckCanGenerate(string text, bool canGenerate, TConfig config) { diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/Ja/JaRubyTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/Ja/JaRubyTagGeneratorTest.cs index 2ec0022f4..f887086ce 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/Ja/JaRubyTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/RubyTags/Ja/JaRubyTagGeneratorTest.cs @@ -31,7 +31,7 @@ public void TestGenerate(string text, string[] expectedRubies) [TestCase("ハナビ", new string[] { })] public void TestGenerateWithRubyAsKatakana(string text, string[] expectedRubies) { - var config = GeneratorConfig(nameof(JaRubyTagGeneratorConfig.RubyAsKatakana)); + var config = GeneratorConfig(x => x.RubyAsKatakana = true); CheckGenerateResult(text, expectedRubies, config); } @@ -39,7 +39,7 @@ public void TestGenerateWithRubyAsKatakana(string text, string[] expectedRubies) [TestCase("ハナビ", new[] { "[0,3]:はなび" })] public void TestGenerateWithEnableDuplicatedRuby(string text, string[] expectedRubies) { - var config = GeneratorConfig(nameof(JaRubyTagGeneratorConfig.EnableDuplicatedRuby)); + var config = GeneratorConfig(x => x.EnableDuplicatedRuby = true); CheckGenerateResult(text, expectedRubies, config); } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/BaseTimeTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/BaseTimeTagGeneratorTest.cs index 85098aa36..147e46767 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/BaseTimeTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/BaseTimeTagGeneratorTest.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Rulesets.Karaoke.Edit.Generator; using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.TimeTags; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Tests.Asserts; @@ -9,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics.TimeTags { public abstract class BaseTimeTagGeneratorTest : BaseLyricGeneratorTest - where TTimeTagGenerator : TimeTagGenerator where TConfig : TimeTagGeneratorConfig, new() + where TTimeTagGenerator : TimeTagGenerator where TConfig : TimeTagGeneratorConfig, IHasConfig, new() { protected static void CheckCanGenerate(string text, bool canGenerate, TConfig config) { diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Ja/JaTimeTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Ja/JaTimeTagGeneratorTest.cs index 313c11ee6..feeca4f25 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Ja/JaTimeTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Ja/JaTimeTagGeneratorTest.cs @@ -25,7 +25,7 @@ public void TestCanGenerate(string text, bool canGenerate) [TestCase("か", new[] { "[0,start]:", "[0,end]:" }, true)] public void TestGenerateWithCheckLineEndKeyUp(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckLineEndKeyUp) : null); + var config = GeneratorConfig(x => x.CheckLineEndKeyUp = applyConfig); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -33,7 +33,7 @@ public void TestGenerateWithCheckLineEndKeyUp(string lyric, string[] expectedTim [TestCase(" ", new[] { "[0,start]:" }, true)] public void TestGenerateWithCheckBlankLine(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckBlankLine) : null); + var config = GeneratorConfig(x => x.CheckBlankLine = applyConfig); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -41,7 +41,7 @@ public void TestGenerateWithCheckBlankLine(string lyric, string[] expectedTimeTa [TestCase("か ", new[] { "[0,start]:", "[1,start]:" }, true)] public void TestGenerateWithCheckWhiteSpace(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpace) : null); + var config = GeneratorConfig(x => x.CheckWhiteSpace = applyConfig); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -49,8 +49,11 @@ public void TestGenerateWithCheckWhiteSpace(string lyric, string[] expectedTimeT [TestCase("か ", new[] { "[0,start]:", "[0,end]:" }, true)] public void TestGenerateWithCheckWhiteSpaceKeyUp(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(nameof(JaTimeTagGeneratorConfig.CheckWhiteSpace), - applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceKeyUp) : null); + var config = GeneratorConfig(x => + { + x.CheckWhiteSpace = true; + x.CheckWhiteSpaceKeyUp = applyConfig; + }); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -62,9 +65,12 @@ public void TestGenerateWithCheckWhiteSpaceKeyUp(string lyric, string[] expected [TestCase("A B C", new[] { "[0,start]:", "[0,end]:", "[2,start]:", "[2,end]:", "[4,start]:" }, true, true)] public void TestGenerateWithCheckWhiteSpaceAlphabet(string lyric, string[] expectedTimeTags, bool applyConfig, bool keyUp) { - var config = GeneratorConfig(nameof(JaTimeTagGeneratorConfig.CheckWhiteSpace), - applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceAlphabet) : null, - keyUp ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceKeyUp) : null); + var config = GeneratorConfig(x => + { + x.CheckWhiteSpace = true; + x.CheckWhiteSpaceAlphabet = applyConfig; + x.CheckWhiteSpaceKeyUp = keyUp; + }); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -76,9 +82,12 @@ public void TestGenerateWithCheckWhiteSpaceAlphabet(string lyric, string[] expec [TestCase("0 1 2", new[] { "[0,start]:", "[0,end]:", "[2,start]:", "[2,end]:", "[4,start]:" }, true, true)] public void TestGenerateWithCheckWhiteSpaceDigit(string lyric, string[] expectedTimeTags, bool applyConfig, bool keyUp) { - var config = GeneratorConfig(nameof(JaTimeTagGeneratorConfig.CheckWhiteSpace), - applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceDigit) : null, - keyUp ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceKeyUp) : null); + var config = GeneratorConfig(x => + { + x.CheckWhiteSpace = true; + x.CheckWhiteSpaceDigit = applyConfig; + x.CheckWhiteSpaceKeyUp = keyUp; + }); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -87,9 +96,12 @@ public void TestGenerateWithCheckWhiteSpaceDigit(string lyric, string[] expected [TestCase("! ! !", new[] { "[0,start]:", "[0,end]:", "[2,start]:", "[2,end]:", "[4,start]:" }, true, true)] public void TestGenerateWitCheckWhiteSpaceAsciiSymbol(string lyric, string[] expectedTimeTags, bool applyConfig, bool keyUp) { - var config = GeneratorConfig(nameof(JaTimeTagGeneratorConfig.CheckWhiteSpace), - applyConfig ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceAsciiSymbol) : null, - keyUp ? nameof(JaTimeTagGeneratorConfig.CheckWhiteSpaceKeyUp) : null); + var config = GeneratorConfig(x => + { + x.CheckWhiteSpace = true; + x.CheckWhiteSpaceAsciiSymbol = applyConfig; + x.CheckWhiteSpaceKeyUp = keyUp; + }); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -97,7 +109,7 @@ public void TestGenerateWitCheckWhiteSpaceAsciiSymbol(string lyric, string[] exp [TestCase("がんばって", new[] { "[0,start]:", "[1,start]:", "[2,start]:", "[4,start]:" }, true)] public void TestGenerateWithCheckWhiteCheckん(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(applyConfig ? nameof(JaTimeTagGeneratorConfig.Checkん) : null); + var config = GeneratorConfig(x => x.Checkん = applyConfig); CheckGenerateResult(lyric, expectedTimeTags, config); } @@ -105,7 +117,7 @@ public void TestGenerateWithCheckWhiteCheckん(string lyric, string[] expectedTi [TestCase("買って", new[] { "[0,start]:", "[1,start]:", "[2,start]:" }, true)] public void TestGenerateWithCheckっ(string lyric, string[] expectedTimeTags, bool applyConfig) { - var config = GeneratorConfig(applyConfig ? nameof(JaTimeTagGeneratorConfig.Checkっ) : null); + var config = GeneratorConfig(x => x.Checkっ = applyConfig); CheckGenerateResult(lyric, expectedTimeTags, config); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Zh/ZhTimeTagGeneratorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Zh/ZhTimeTagGeneratorTest.cs index cee892d38..bc50d8323 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Zh/ZhTimeTagGeneratorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/TimeTags/Zh/ZhTimeTagGeneratorTest.cs @@ -25,7 +25,7 @@ public void TestCanGenerate(string text, bool canGenerate) [TestCase("拉~拉~拉~", new[] { "[0,start]:", "[2,start]:", "[4,start]:", "[5,end]:" })] public void TestGenerateWithCheckLineEndKeyUp(string lyric, string[] expectedTimeTags) { - var config = GeneratorConfig(nameof(ZhTimeTagGeneratorConfig.CheckLineEndKeyUp)); + var config = GeneratorConfig(x => x.CheckLineEndKeyUp = true); CheckGenerateResult(lyric, expectedTimeTags, config); } }