Пример #1
0
        public void TestShiftRhythmMeasures()
        {
            int       upbeatOffset;
            Key       key;
            Workspace w = new Workspace(-1, false, -1);

            List <Measure> measures = Rhythm.ParseRhythmMeasures(w, "Q | QQQ_ | QQQ | H_E.S", out upbeatOffset, out key);

            Assert.AreEqual(4, upbeatOffset);
            List <Measure> expected = Rhythm.ParseRhythmMeasures(w, "QQQ | HQ | QH_ | E.S ", out upbeatOffset, out key);
            List <Measure> shifted  = Rhythm.ShiftRhythmMeasures(w, measures, 4);

            Assert.AreEqual(0, upbeatOffset);
            AssertMeasureListsEqual(expected, shifted);

            measures = Rhythm.ParseRhythmMeasures(w, "H | QQQQ | HQQ_ | QQH_ | W_ | H", out upbeatOffset, out key);
            Assert.AreEqual(8, upbeatOffset);
            expected = Rhythm.ParseRhythmMeasures(w, "HQQ | QQH | QHQ | W_ | W", out upbeatOffset, out key);
            Assert.AreEqual(0, upbeatOffset);
            shifted = Rhythm.ShiftRhythmMeasures(w, measures, 8);

            AssertMeasureListsEqual(expected, shifted);
        }