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); }
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); }
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 TestCheckIsEndTimeInvalid(string lyricText, string[] timeTags, bool actual) { var lyric = TestCaseTagHelper.ParseLyric(lyricText); lyric.TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags); Assert.AreEqual(LyricUtils.CheckIsEndTimeInvalid(lyric), actual); }
//[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); }
public void TestGetEndTime(string[] timeTagTexts, double?actualEndTime) { var timeTags = TestCaseTagHelper.ParseTimeTags(timeTagTexts); var endTime = TimeTagsUtils.GetEndTime(timeTags); Assert.AreEqual(endTime, actualEndTime); }
public void TestSort(string[] timeTagTexts, string[] actualTimeTags) { var timeTags = TestCaseTagHelper.ParseTimeTags(timeTagTexts); var sortedTimeTag = TimeTagsUtils.Sort(timeTags); TimeTagAssert.AreEqual(sortedTimeTag, TestCaseTagHelper.ParseTimeTags(actualTimeTags)); }
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)); }
[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); }
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); }
//[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)); }
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), })); }
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); }
public void TestTimeTagTimeFormattedString(string[] timeTags, string format) { var lyric = new Lyric { TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), }; Assert.AreEqual(LyricUtils.TimeTagTimeFormattedString(lyric), format); }
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); }
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); }
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); }
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); }
public void TestHasTimedTimeTags(string[] timeTags, bool hasTimedTimeTag) { var lyric = new Lyric { Text = "カラオケ", TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), }; Assert.AreEqual(LyricUtils.HasTimedTimeTags(lyric), hasTimedTimeTag); }
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)); }
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); }
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); }
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 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); }
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)); }
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)); }
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)); }
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)); }
[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); }