public void TestCombine(string[] textTags, string actualTextTag)
        {
            var rubyTags      = TestCaseTagHelper.ParseRubyTags(textTags);
            var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTextTag);

            TextTagAssert.ArePropertyEqual(TextTagsUtils.Combine(rubyTags), actualRubyTag);
        }
        [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);

            Assert.AreEqual(TextTagUtils.Shifting(rubyTag, shifting), actualRubyTag);

            // test romaji tag.
            var romajiTag    = TestCaseTagHelper.ParseRubyTag(textTag);
            var actualRomaji = TestCaseTagHelper.ParseRubyTag(actualTag);

            Assert.AreEqual(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);

            Assert.AreEqual(TextTagUtils.FixTimeTagPosition(rubyTag), actualRubyTag);

            // test romaji tag.
            var romajiTag    = TestCaseTagHelper.ParseRubyTag(textTag);
            var actualRomaji = TestCaseTagHelper.ParseRubyTag(actualTag);

            Assert.AreEqual(TextTagUtils.FixTimeTagPosition(romajiTag), actualRomaji);
        }
        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);
        }
        public void TestPositionFormattedString(string textTag, string actual)
        {
            var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag);

            Assert.AreEqual(TextTagUtils.PositionFormattedString(rubyTag), actual);
        }
        [TestCase("[0,0]:ka", null, true)] // should be counted as out of range if lyric is null
        public void TestOutOfRange(string textTag, string lyric, bool outOfRange)
        {
            var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag);

            Assert.AreEqual(TextTagUtils.OutOfRange(rubyTag, lyric), outOfRange);
        }
Exemple #7
0
        public void TestGetTextFromLyric(string textTag, string lyric, string actual)
        {
            var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag);

            Assert.AreEqual(TextTagUtils.GetTextFromLyric(rubyTag, lyric), actual);
        }