public void TextAddTextRomaji(string[] romajies, int position, string addedText, string[] targetRomajies) { var lyric = new Lyric { Text = "カラオケ", RomajiTags = TestCaseTagHelper.ParseRomajiTags(romajies), }; LyricUtils.AddText(lyric, position, addedText); TextTagAssert.ArePropertyEqual(lyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(targetRomajies)); }
public void TestRemoveTextRomaji(string[] romajies, int position, int count, string[] targetRomajies) { var lyric = new Lyric { Text = "カラオケ", RomajiTags = TestCaseTagHelper.ParseRomajiTags(romajies), }; LyricUtils.RemoveText(lyric, position, count); Assert.AreEqual(lyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(targetRomajies)); }
protected void RunRomajiCheckTest(string text, string[] actualRomaji, JaRomajiTagGeneratorConfig config) { var generator = new JaRomajiTagGenerator(config); var lyric = new Lyric { Text = text }; var romajiTags = generator.CreateRomajiTags(lyric); var actualRomajiTags = TestCaseTagHelper.ParseRomajiTags(actualRomaji); TextTagAssert.ArePropertyEqual(romajiTags, actualRomajiTags); }
[TestCase(1028, "はなび", null)] // Chinese(should not supported) public void TestCreateRomajiTag(int lcid, string text, string[] actualRomaji) { var lyric = new Lyric { Language = new CultureInfo(lcid), Text = text, }; var selector = new RomajiTagGeneratorSelector(); var generatedRomaji = selector.GenerateRomajiTags(lyric); Assert.AreEqual(generatedRomaji, TestCaseTagHelper.ParseRomajiTags(actualRomaji)); }
public void TestCheckInvalidRomajiTags(string text, string[] romajies, RomajiTagInvalid[] invalids) { var lyric = new Lyric { Text = text, RomajiTags = TestCaseTagHelper.ParseRomajiTags(romajies) }; var issue = run(lyric).OfType <RomajiTagIssue>().FirstOrDefault(); var invalidRomajiTagDictionaryKeys = issue?.InvalidRomajiTags.Keys.ToArray() ?? Array.Empty <RomajiTagInvalid>(); Assert.AreEqual(invalidRomajiTagDictionaryKeys, invalids); }
public void TestCheckInvalidRomajiTags(string text, string[] romajies, RomajiTagInvalid[] invalids) { var lyric = new Lyric { Text = text, RomajiTags = TestCaseTagHelper.ParseRomajiTags(romajies) }; var checker = createChecker(); var result = checker.CheckInvalidRomajiTags(lyric); Assert.AreEqual(result.Keys.ToArray(), invalids); }
public void TestSeparateLyricRomajiTag(string text, string[] romajiTags, int splitIndex, string[] firstRomajiTags, string[] secondRomajiTags) { var lyric = new Lyric { Text = text, RomajiTags = TestCaseTagHelper.ParseRomajiTags(romajiTags) }; var(firstLyric, secondLyric) = LyricsUtils.SplitLyric(lyric, splitIndex); Assert.AreEqual(firstLyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(firstRomajiTags)); Assert.AreEqual(secondLyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(secondRomajiTags)); }
public void TestRemoveTextTag(string[] textTags, string removeTextTag, bool actual) { var lyric = new Lyric { Text = "からおけ", RubyTags = TestCaseTagHelper.ParseRubyTags(textTags), RomajiTags = TestCaseTagHelper.ParseRomajiTags(textTags) }; var fromIndex = textTags?.IndexOf(removeTextTag) ?? -1; // test ruby and romaji at the same test. var removeRubyTag = fromIndex >= 0 ? lyric.RubyTags[fromIndex] : TestCaseTagHelper.ParseRubyTag(removeTextTag); var removeRomajiTag = fromIndex >= 0 ? lyric.RomajiTags[fromIndex] : TestCaseTagHelper.ParseRomajiTag(removeTextTag); Assert.AreEqual(LyricUtils.RemoveTextTag(lyric, removeRubyTag), actual); Assert.AreEqual(LyricUtils.RemoveTextTag(lyric, removeRomajiTag), actual); }
[TestCase(new[] { "[-10,0]:" }, new[] { "[-10,0]:" }, new[] { "[-10,0]:", "[-3,7]:" })] // deal with the case out of range. public void TestCombineLyricRomajiTag(string[] firstRomajiTags, string[] secondRomajiTags, string[] actualRomajiTags) { var lyric1 = new Lyric { Text = "karaoke", RomajiTags = TestCaseTagHelper.ParseRomajiTags(firstRomajiTags) }; var lyric2 = new Lyric { Text = "karaoke", RomajiTags = TestCaseTagHelper.ParseRomajiTags(secondRomajiTags) }; var combineLyric = LyricsUtils.CombineLyric(lyric1, lyric2); var romajiTags = combineLyric.RomajiTags; Assert.AreEqual(romajiTags, TestCaseTagHelper.ParseRomajiTags(actualRomajiTags)); }