Beispiel #1
0
        public void TestSeparateNoteOtherProperty()
        {
            const double percentage = 0.3;
            var          lyric      = new Lyric
            {
                Singers = new[] { 0 },
            };

            var note = new Note
            {
                StartTime   = 1000,
                Duration    = 2000,
                StartIndex  = 1,
                EndIndex    = 2,
                Text        = "ka",
                Display     = false,
                Tone        = new Tone(-1, true),
                ParentLyric = lyric
            };

            // create other property and make sure other class is applied value.
            var(firstNote, secondNote) = NotesUtils.SplitNote(note, percentage);

            Assert.AreEqual(firstNote.StartTime, 1000);
            Assert.AreEqual(secondNote.StartTime, 1600);

            Assert.AreEqual(firstNote.Duration, 600);
            Assert.AreEqual(secondNote.Duration, 1400);

            testRemainProperty(firstNote, note);
            testRemainProperty(firstNote, note);
Beispiel #2
0
 public void SplitNote(Note note, float percentage = 0.5f)
 {
     var(firstNote, secondNote) = NotesUtils.SplitNote(note, 0.5);
     beatmap?.Add(firstNote);
     beatmap?.Add(secondNote);
     beatmap?.Remove(note);
 }
Beispiel #3
0
        public void TestSeparateNoteTime(double[] time, double percentage, double[] firstTime, double[] secondTime)
        {
            var note = new Note
            {
                StartTime = time[0],
                Duration  = time[1],
            };

            try
            {
                var(firstNote, secondNote) = NotesUtils.SplitNote(note, percentage);
                Assert.AreEqual(firstNote.StartTime, firstTime[0]);
                Assert.AreEqual(firstNote.Duration, firstTime[1]);

                Assert.AreEqual(secondNote.StartTime, secondTime[0]);
                Assert.AreEqual(secondNote.Duration, secondTime[1]);
            }
            catch
            {
                Assert.IsNull(firstTime);
                Assert.IsNull(secondTime);
            }
        }