Пример #1
0
        public void TestCombine(string[] textTags, string actualTextTag)
        {
            var rubyTags      = TestCaseTagHelper.ParseRubyTags(textTags);
            var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTextTag);

            TextTagAssert.ArePropertyEqual(TextTagsUtils.Combine(rubyTags), actualRubyTag);
        }
Пример #2
0
        public void TestGetTimeTagDisplayRubyText(int indexOfTimeTag, string actual)
        {
            var lyric = new Lyric
            {
                Text     = "カラオケ",
                TimeTags = TestCaseTagHelper.ParseTimeTags(new[]
                {
                    "[0,start]:1000",
                    "[0,start]:1000",
                    "[0,end]:1000",
                    "[1,start]:2000",
                    "[1,start]:2000",
                    "[1,end]:2000",
                    "[2,start]:3000",
                    "[2,start]:3000",
                    "[3,start]:4000",
                    "[3,end]:5000",
                }),
                RubyTags = TestCaseTagHelper.ParseRubyTags(new[]
                {
                    "[0,1]:か",
                    "[2,4]:おけ",
                })
            };
            var timeTag = lyric.TimeTags[indexOfTimeTag];

            Assert.AreEqual(LyricUtils.GetTimeTagDisplayRubyText(lyric, timeTag), actual);
        }
Пример #3
0
        public void TestRemoveTextRuby(string[] rubies, int position, int count, string[] targetRubies)
        {
            var lyric = new Lyric
            {
                Text     = "カラオケ",
                RubyTags = TestCaseTagHelper.ParseRubyTags(rubies),
            };

            LyricUtils.RemoveText(lyric, position, count);
            Assert.AreEqual(lyric.RubyTags, TestCaseTagHelper.ParseRubyTags(targetRubies));
        }
Пример #4
0
        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));
        }
Пример #5
0
        [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));
        }
Пример #6
0
        protected void RunRubyCheckTest(string text, string[] actualRuby, JaRubyTagGeneratorConfig config)
        {
            var generator = new JaRubyTagGenerator(config);

            var lyric = new Lyric {
                Text = text
            };
            var rubyTags       = generator.CreateRubyTags(lyric);
            var actualRubyTags = TestCaseTagHelper.ParseRubyTags(actualRuby);

            TextTagAssert.ArePropertyEqual(rubyTags, actualRubyTags);
        }
        public void TestCheckInvalidRubyTags(string text, string[] rubies, RubyTagInvalid[] invalids)
        {
            var lyric = new Lyric
            {
                Text     = text,
                RubyTags = TestCaseTagHelper.ParseRubyTags(rubies)
            };

            var issue = run(lyric).OfType <RubyTagIssue>().FirstOrDefault();
            var invalidRubyTagDictionaryKeys = issue?.InvalidRubyTags.Keys.ToArray() ?? Array.Empty <RubyTagInvalid>();

            Assert.AreEqual(invalidRubyTagDictionaryKeys, invalids);
        }
Пример #8
0
        public void TestCheckInvalidRubyTags(string text, string[] rubies, RubyTagInvalid[] invalids)
        {
            var lyric = new Lyric
            {
                Text     = text,
                RubyTags = TestCaseTagHelper.ParseRubyTags(rubies)
            };

            var checker = createChecker();
            var result  = checker.CheckInvalidRubyTags(lyric);

            Assert.AreEqual(result.Keys.ToArray(), invalids);
        }
Пример #9
0
        public void TestSeparateLyricRubyTag(string text, string[] rubyTags, int splitIndex, string[] firstRubyTags, string[] secondRubyTags)
        {
            var lyric = new Lyric
            {
                Text     = text,
                RubyTags = TestCaseTagHelper.ParseRubyTags(rubyTags)
            };

            var(firstLyric, secondLyric) = LyricsUtils.SplitLyric(lyric, splitIndex);

            Assert.AreEqual(firstLyric.RubyTags, TestCaseTagHelper.ParseRubyTags(firstRubyTags));
            Assert.AreEqual(secondLyric.RubyTags, TestCaseTagHelper.ParseRubyTags(secondRubyTags));
        }
Пример #10
0
        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);
        }
Пример #11
0
        [TestCase(new[] { "[-10,0]:" }, new[] { "[-10,0]:" }, new[] { "[-10,0]:", "[-3,7]:" })] // deal with the case out of range.
        public void TestCombineLyricRubyTag(string[] firstRubyTags, string[] secondRubyTags, string[] actualRubyTags)
        {
            var lyric1 = new Lyric
            {
                Text     = "karaoke",
                RubyTags = TestCaseTagHelper.ParseRubyTags(firstRubyTags)
            };
            var lyric2 = new Lyric
            {
                Text     = "karaoke",
                RubyTags = TestCaseTagHelper.ParseRubyTags(secondRubyTags)
            };

            var combineLyric = LyricsUtils.CombineLyric(lyric1, lyric2);
            var rubyTags     = combineLyric.RubyTags;

            Assert.AreEqual(rubyTags, TestCaseTagHelper.ParseRubyTags(actualRubyTags));
        }
Пример #12
0
        public void TestFindOverlapping(string[] textTags, TextTagsUtils.Sorting sorting, string[] actualTextTags)
        {
            var invalidTextTag = TextTagsUtils.FindOverlapping(TestCaseTagHelper.ParseRubyTags(textTags), sorting);

            TextTagAssert.ArePropertyEqual(invalidTextTag, TestCaseTagHelper.ParseRubyTags(actualTextTags));
        }
Пример #13
0
        public void TestFindOutOfRange(string[] textTags, string lyric, string[] actualTextTags)
        {
            var invalidTextTag = TextTagsUtils.FindOutOfRange(TestCaseTagHelper.ParseRubyTags(textTags), lyric);

            TextTagAssert.ArePropertyEqual(invalidTextTag, TestCaseTagHelper.ParseRubyTags(actualTextTags));
        }
Пример #14
0
        public void TestSort(string[] textTags, TextTagsUtils.Sorting sorting, string[] actualTextTags)
        {
            var sortedTextTags = TextTagsUtils.Sort(TestCaseTagHelper.ParseRubyTags(textTags), sorting);

            TextTagAssert.ArePropertyEqual(sortedTextTags, TestCaseTagHelper.ParseRubyTags(actualTextTags));
        }