Пример #1
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);
        }
Пример #2
0
        public void TestGetTimeTagIndexDisplayText(string text, string textIndexStr, string actual)
        {
            var lyric     = TestCaseTagHelper.ParseLyricWithTimeTag(text);
            var textIndex = TestCaseTagHelper.ParseTextIndex(textIndexStr);

            Assert.AreEqual(LyricUtils.GetTimeTagIndexDisplayText(lyric, textIndex), actual);
        }
Пример #3
0
        public void TestCombine(string[] textTags, string actualTextTag)
        {
            var rubyTags      = TestCaseTagHelper.ParseRubyTags(textTags);
            var actualRubyTag = TestCaseTagHelper.ParseRubyTag(actualTextTag);

            TextTagAssert.ArePropertyEqual(TextTagsUtils.Combine(rubyTags), actualRubyTag);
        }
Пример #4
0
        public void TestCheckIsEndTimeInvalid(string lyricText, string[] timeTags, bool actual)
        {
            var lyric = TestCaseTagHelper.ParseLyric(lyricText);

            lyric.TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags);
            Assert.AreEqual(LyricUtils.CheckIsEndTimeInvalid(lyric), actual);
        }
Пример #5
0
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, new double[] { 4000, 4000, 4000, 4000 })]
        public void TestToDictionary(string[] timeTagTexts, double[] actualTimes)
        {
            var timeTags   = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var dictionary = TimeTagsUtils.ToDictionary(timeTags);

            Assert.AreEqual(dictionary.Values.ToArray(), actualTimes);
        }
Пример #6
0
        public void TestGetEndTime(string[] timeTagTexts, double?actualEndTime)
        {
            var timeTags = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var endTime  = TimeTagsUtils.GetEndTime(timeTags);

            Assert.AreEqual(endTime, actualEndTime);
        }
Пример #7
0
        public void TestSort(string[] timeTagTexts, string[] actualTimeTags)
        {
            var timeTags      = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var sortedTimeTag = TimeTagsUtils.Sort(timeTags);

            TimeTagAssert.AreEqual(sortedTimeTag, TestCaseTagHelper.ParseTimeTags(actualTimeTags));
        }
Пример #8
0
        public void TestFindOutOfRange(string text, string[] timeTagTexts, string[] invalidTimeTags)
        {
            var timeTags           = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var outOfRangeTimeTags = TimeTagsUtils.FindOutOfRange(timeTags, text);

            TimeTagAssert.AreEqual(outOfRangeTimeTags, TestCaseTagHelper.ParseTimeTags(invalidTimeTags));
        }
Пример #9
0
        [TestCase("", new[] { "[0,start]:1000", "[0,end]:2000" }, false)]      // empty lyric should always count as missing.
        public void TestHasStartTimeTagInLyric(string text, string[] timeTagTexts, bool actual)
        {
            var timeTags = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var missing  = TimeTagsUtils.HasStartTimeTagInLyric(timeTags, text);

            Assert.AreEqual(missing, actual);
        }
Пример #10
0
        public void TestGetTimeTagDisplayText(string text, string textIndexStr, string actual)
        {
            var lyric     = TestCaseTagHelper.ParseLyricWithTimeTag(text);
            var textIndex = TestCaseTagHelper.ParseTextIndex(textIndexStr);
            var timeTag   = lyric.TimeTags?.Where(x => x.Index == textIndex).FirstOrDefault();

            Assert.AreEqual(LyricUtils.GetTimeTagDisplayText(lyric, timeTag), actual);
        }
Пример #11
0
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Asc, SelfCheck.BasedOnStart, new double[] { "[0,start]:4000", "[0,end]:4000", "[1,start]:4000", "[1,end]:4000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Asc, SelfCheck.BasedOnEnd, new double[] { "[0,start]:3000", "[0,end]:3000", "[1,start]:3000", "[1,end]:3000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Desc, SelfCheck.BasedOnStart, new double[] { "[0,start]:2000", "[0,end]:2000", "[1,start]:2000", "[1,end]:2000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Desc, SelfCheck.BasedOnEnd, new double[] { "[0,start]:1000", "[0,end]:1000", "[1,start]:1000", "[1,end]:1000" })]
        public void TestFixInvalid(string[] timeTagTexts, GroupCheck other, SelfCheck self, string[] actualTimeTagTexts)
        {
            // check which part is fixed, using list of time to check result.
            var timeTags     = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var fixedTimeTag = TimeTagsUtils.FixInvalid(timeTags, other, self);

            TimeTagAssert.AreEqual(fixedTimeTag, TestCaseTagHelper.ParseTimeTags(actualTimeTagTexts));
        }
Пример #12
0
 public void TestText(string text, string[] rubyTags, string[] romajiTags)
 {
     AddStep("Create lyric", () => setContents(() => new LyricSpriteText
     {
         Text     = text,
         Rubies   = TestCaseTagHelper.ParseParsePositionTexts(rubyTags),
         Romajies = TestCaseTagHelper.ParseParsePositionTexts(romajiTags),
     }));
 }
Пример #13
0
        public void TestFindOverlapping(string[] timeTagTexts, GroupCheck other, SelfCheck self, int[] errorIndex)
        {
            // run all and find overlapping indexes.
            var timeTags                  = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var overlappingTimeTags       = TimeTagsUtils.FindOverlapping(timeTags, other, self);
            var overlappingTimeTagIndexed = overlappingTimeTags.Select(v => timeTags.IndexOf(v)).ToArray();

            Assert.AreEqual(overlappingTimeTagIndexed, errorIndex);
        }
Пример #14
0
        public void TestTimeTagTimeFormattedString(string[] timeTags, string format)
        {
            var lyric = new Lyric
            {
                TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags),
            };

            Assert.AreEqual(LyricUtils.TimeTagTimeFormattedString(lyric), format);
        }
Пример #15
0
        public void TestFindInvalid(string[] timeTagTexts, GroupCheck other, SelfCheck self, int[] errorIndex)
        {
            // run all and find invalid indexes.
            var timeTags       = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var invalidTimeTag = TimeTagsUtils.FindInvalid(timeTags, other, self);
            var invalidIndexes = invalidTimeTag.Select(v => timeTags.IndexOf(v)).ToArray();

            Assert.AreEqual(invalidIndexes, errorIndex);
        }
Пример #16
0
                  new[] { "[1000,3000]", "[6000,8000]", "[4000,12000]" })] // todo : second lyric start time should be 6000 but can be ignored now.
        public void TestApplyLayoutTime(string[] lyricTexts, string[] actualTimes)
        {
            var lyrics = TestCaseTagHelper.ParseLyrics(lyricTexts);

            var generator = new LayoutGenerator(generatorConfig());

            generator.ApplyLayout(lyrics);

            Assert.AreEqual(lyrics.Select(x => $"[{x.StartTime},{x.EndTime}]").ToArray(), actualTimes);
        }
Пример #17
0
        public void TestShiftingTimeTag(string shiftingTag, int shifting, string actualTag)
        {
            var timeTag = TestCaseTagHelper.ParseTimeTag(shiftingTag);

            var shiftingTimeTag = TimeTagUtils.ShiftingTimeTag(timeTag, shifting);
            var actualTimeTag   = TestCaseTagHelper.ParseTimeTag(actualTag);

            Assert.AreEqual(shiftingTimeTag.Index, actualTimeTag.Index);
            Assert.AreEqual(shiftingTimeTag.Time, actualTimeTag.Time);
        }
Пример #18
0
        public void TestOnlyContainsSingers(string[] existSingers, string[] compareSingers, bool isContain)
        {
            var singers = TestCaseTagHelper.ParseSingers(compareSingers).ToList();
            var lyric   = new Lyric
            {
                Singers = TestCaseTagHelper.ParseSingers(existSingers)?.Select(x => x.ID).ToArray()
            };

            Assert.AreEqual(LyricUtils.OnlyContainsSingers(lyric, singers), isContain);
        }
Пример #19
0
        public void TestHasTimedTimeTags(string[] timeTags, bool hasTimedTimeTag)
        {
            var lyric = new Lyric
            {
                Text     = "カラオケ",
                TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags),
            };

            Assert.AreEqual(LyricUtils.HasTimedTimeTags(lyric), hasTimedTimeTag);
        }
Пример #20
0
        public void TestLyricTimeTag(string text, string[] timeTags)
        {
            var beatmap = decodeLrcLine(text);

            // Get first lyric from beatmap
            var lyric = beatmap.HitObjects.OfType <Lyric>().FirstOrDefault();

            // Check time tag
            TimeTagAssert.ArePropertyEqual(lyric?.TimeTags, TestCaseTagHelper.ParseTimeTags(timeTags));
        }
Пример #21
0
        public void TestCheckInvalidLyricTime(string lyricText, string[] timeTags, TimeInvalid[] invalid)
        {
            var lyric = TestCaseTagHelper.ParseLyric(lyricText);

            lyric.TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags);

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

            Assert.AreEqual(result, invalid);
        }
Пример #22
0
        protected void RunTimeTagCheckTest(Lyric lyric, string[] actualTimeTags, TConfig config)
        {
            var generator = Activator.CreateInstance(typeof(TTimeTagGenerator), config) as TTimeTagGenerator;

            // create time tag and actually time tag.
            var timeTags      = generator?.CreateTimeTags(lyric);
            var actualIndexed = TestCaseTagHelper.ParseTimeTags(actualTimeTags);

            // check should be equal
            TimeTagAssert.AreEqual(timeTags, actualIndexed);
        }
Пример #23
0
        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));
        }
Пример #24
0
        public void TestRemoveTextTimeTag(string[] timeTags, int position, int count, string[] actualTimeTags)
        {
            var lyric = new Lyric
            {
                Text     = "カラオケ",
                TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags),
            };

            LyricUtils.RemoveText(lyric, position, count);
            TimeTagAssert.AreEqual(lyric.TimeTags, TestCaseTagHelper.ParseTimeTags(actualTimeTags));
        }
        public void TestCheckInvalidLyricTime(string lyricText, string[] timeTags, TimeInvalid[] invalid)
        {
            var lyric = TestCaseTagHelper.ParseLyric(lyricText);

            lyric.TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags);

            var issue = run(lyric).OfType <LyricTimeIssue>().FirstOrDefault();
            var invalidTimeTagDictionaryKeys = issue?.InvalidLyricTime ?? Array.Empty <TimeInvalid>();

            Assert.AreEqual(invalidTimeTagDictionaryKeys, invalid);
        }
Пример #26
0
        public void TestAddTextTimeTag(string[] timeTags, int position, string addedText, string[] actualTimeTags)
        {
            var lyric = new Lyric
            {
                Text     = "カラオケ",
                TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags),
            };

            LyricUtils.AddText(lyric, position, addedText);
            TimeTagAssert.ArePropertyEqual(lyric.TimeTags, TestCaseTagHelper.ParseTimeTags(actualTimeTags));
        }
Пример #27
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);
            Assert.AreEqual(lyric.RubyTags, TestCaseTagHelper.ParseRubyTags(targetRubies));
        }
Пример #28
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);
            TextTagAssert.ArePropertyEqual(lyric.RubyTags, TestCaseTagHelper.ParseRubyTags(targetRubies));
        }
Пример #29
0
        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));
        }
Пример #30
0
        [TestCase(new[] { "[0,0]:か", "[0,0]:ら", "[0,0]:お", "[0,0]:け" }, "か\nら\nお\nけ")] // multi lyric.
        public void TestEncodeBeatmapToPureText(string[] lyrics, string actual)
        {
            var encoder = new LyricTextEncoder();
            var beatmap = new KaraokeBeatmap
            {
                HitObjects = TestCaseTagHelper.ParseLyrics(lyrics).OfType <KaraokeHitObject>().ToList()
            };
            var result = encoder.Encode(beatmap);

            Assert.AreEqual(result, actual);
        }