public void TestCombine(string[] textTags, string actualTextTag) { var rubyTags = TestCaseTagHelper.ParseRubyTags(textTags); var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTextTag); TextTagAssert.ArePropertyEqual(TextTagsUtils.Combine(rubyTags), actualRubyTag); }
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); TextTagAssert.ArePropertyEqual(lyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(targetRomajies)); }
public void TextAddTextRuby(string[] rubies, int position, string addedText, string[] targetRubies) { var lyric = new Lyric { Text = "カラオケ", RubyTags = TestCaseTagHelper.ParseRubyTags(rubies), }; LyricUtils.AddText(lyric, position, addedText); TextTagAssert.ArePropertyEqual(lyric.RubyTags, TestCaseTagHelper.ParseRubyTags(targetRubies)); }
[TestCase(1028, "はなび", null)] // Chinese(should not supported) public void TestCreateRubyTag(int lcid, string text, string[] actualRuby) { var lyric = new Lyric { Language = new CultureInfo(lcid), Text = text, }; var selector = new RubyTagGeneratorSelector(); var generatedRuby = selector.GenerateRubyTags(lyric); TextTagAssert.ArePropertyEqual(generatedRuby, TestCaseTagHelper.ParseRubyTags(actualRuby)); }
public void TestDeserialize(string json, int startIndex, int endIndex, string text) { var result = JsonConvert.DeserializeObject <RubyTag>($"\"{json}\"", CreateSettings()); var actual = new RubyTag { StartIndex = startIndex, EndIndex = endIndex, Text = text }; TextTagAssert.ArePropertyEqual(result, actual); }
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); }
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); TextTagAssert.ArePropertyEqual(firstLyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(firstRomajiTags)); TextTagAssert.ArePropertyEqual(secondLyric.RomajiTags, TestCaseTagHelper.ParseRomajiTags(secondRomajiTags)); }
[TestCase("[1,0]:ka", 1, "[2,1]:ka")] // do not check order in here. public void TestShifting(string textTag, int shifting, string actualTag) { // test ruby tag. var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag); var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTag); TextTagAssert.ArePropertyEqual(TextTagUtils.Shifting(rubyTag, shifting), actualRubyTag); // test romaji tag. var romajiTag = TestCaseTagHelper.ParseRubyTag(textTag); var actualRomaji = TestCaseTagHelper.ParseRubyTag(actualTag); TextTagAssert.ArePropertyEqual(TextTagUtils.Shifting(romajiTag, shifting), actualRomaji); }
[TestCase("[3,-1]:ka", "[-1,3]:ka")] // fix but ignore negative index. public void TestFixTimeTagPosition(string textTag, string actualTag) { // test ruby tag. var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag); var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTag); TextTagAssert.ArePropertyEqual(TextTagUtils.FixTimeTagPosition(rubyTag), actualRubyTag); // test romaji tag. var romajiTag = TestCaseTagHelper.ParseRubyTag(textTag); var actualRomaji = TestCaseTagHelper.ParseRubyTag(actualTag); TextTagAssert.ArePropertyEqual(TextTagUtils.FixTimeTagPosition(romajiTag), actualRomaji); }
[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; TextTagAssert.ArePropertyEqual(romajiTags, TestCaseTagHelper.ParseRomajiTags(actualRomajiTags)); }
public void TestFindOverlapping(string[] textTags, TextTagsUtils.Sorting sorting, string[] actualTextTags) { var invalidTextTag = TextTagsUtils.FindOverlapping(TestCaseTagHelper.ParseRubyTags(textTags), sorting); TextTagAssert.ArePropertyEqual(invalidTextTag, TestCaseTagHelper.ParseRubyTags(actualTextTags)); }
public void TestFindOutOfRange(string[] textTags, string lyric, string[] actualTextTags) { var invalidTextTag = TextTagsUtils.FindOutOfRange(TestCaseTagHelper.ParseRubyTags(textTags), lyric); TextTagAssert.ArePropertyEqual(invalidTextTag, TestCaseTagHelper.ParseRubyTags(actualTextTags)); }
public void TestSort(string[] textTags, TextTagsUtils.Sorting sorting, string[] actualTextTags) { var sortedTextTags = TextTagsUtils.Sort(TestCaseTagHelper.ParseRubyTags(textTags), sorting); TextTagAssert.ArePropertyEqual(sortedTextTags, TestCaseTagHelper.ParseRubyTags(actualTextTags)); }