Search in sources :

Example 41 with MP

use of com.xenoage.zong.core.position.MP in project Zong by Xenoage.

the class Test21e method test.

@Test
public void test() {
    Score score = getScore();
    // 4/4 time in first measure (implicit)
    assertEquals(Companion.fr(4, 4), score.getColumnHeader(0).getTime().getType().getMeasureBeats());
    // first measure has only a 1/4 chord and a total length of 1/4
    assertEquals(1, score.getVoice(mp0).getElements().size());
    assertEquals(Companion.fr(1, 4), score.getVoice(mp0).getElement(0).getDuration());
    assertEquals(Companion.fr(1, 4), score.getMeasure(mp0).getFilledBeats());
    // second measure has two 1/4 chords and total length of 2/4
    MP m2 = mp0.withMeasure(1);
    assertEquals(2, score.getVoice(m2).getElements().size());
    assertEquals(Companion.fr(1, 4), score.getVoice(m2).getElement(0).getDuration());
    assertEquals(Companion.fr(1, 4), score.getVoice(m2).getElement(1).getDuration());
    assertEquals(Companion.fr(2, 4), score.getMeasure(m2).getFilledBeats());
}
Also used : Score(com.xenoage.zong.core.Score) MP(com.xenoage.zong.core.position.MP) Test(org.junit.Test)

Example 42 with MP

use of com.xenoage.zong.core.position.MP in project Zong by Xenoage.

the class Test42b method testVoiceElements.

private void testVoiceElements() {
    for (int iStaff : range(2)) {
        for (int iMeasure : range(2)) {
            MP mpVoice = atVoice(iStaff, iMeasure, 0);
            Voice expectedVoice = expectedStaves[iStaff].getVoice(mpVoice);
            Voice voice = score.getVoice(mpVoice);
            assertEqualsVoice(expectedVoice, voice, mpVoice);
        }
    }
}
Also used : MP(com.xenoage.zong.core.position.MP) MP.atVoice(com.xenoage.zong.core.position.MP.atVoice) VoiceTest.assertEqualsVoice(musicxmltestsuite.tests.utils.VoiceTest.assertEqualsVoice) Voice(com.xenoage.zong.core.music.Voice)

Example 43 with MP

use of com.xenoage.zong.core.position.MP in project Zong by Xenoage.

the class Test46e method testVoiceElements.

private void testVoiceElements() {
    for (int iMeasure : range(2)) {
        Measure expectedMeasure = expectedStaff.getMeasure(iMeasure);
        Measure measure = score.getMeasure(atMeasure(0, iMeasure));
        int expectedVoicesCount = expectedMeasure.getVoices().size();
        assertEquals(expectedVoicesCount, measure.getVoices().size());
        for (int iVoice : range(expectedVoicesCount)) {
            MP mpVoice = atVoice(0, iMeasure, iVoice);
            Voice expectedVoice = expectedStaff.getVoice(mpVoice);
            Voice voice = score.getVoice(mpVoice);
            assertEqualsVoice(expectedVoice, voice, mpVoice);
        }
    }
}
Also used : MP(com.xenoage.zong.core.position.MP) MP.atMeasure(com.xenoage.zong.core.position.MP.atMeasure) Measure(com.xenoage.zong.core.music.Measure) MP.atVoice(com.xenoage.zong.core.position.MP.atVoice) VoiceTest.assertEqualsVoice(musicxmltestsuite.tests.utils.VoiceTest.assertEqualsVoice) Voice(com.xenoage.zong.core.music.Voice)

Example 44 with MP

use of com.xenoage.zong.core.position.MP in project Zong by Xenoage.

the class Test61a method test.

@Test
public void test() {
    for (int iMeasure : range(3)) {
        for (int iElement : range(iMeasure == 2 ? 3 : 4)) {
            MP mp = MP.atElement(0, iMeasure, 0, iElement);
            Chord chord = ChordTest.getChordAt(score, mp);
            assertEqualsChordLyrics(expectedLyrics[iMeasure * 4 + iElement], chord, mp);
        }
    }
}
Also used : MP(com.xenoage.zong.core.position.MP) Chord(com.xenoage.zong.core.music.chord.Chord) ChordTest(musicxmltestsuite.tests.utils.ChordTest) Test(org.junit.Test)

Example 45 with MP

use of com.xenoage.zong.core.position.MP in project Zong by Xenoage.

the class Test61b method test.

@Test
public void test() {
    for (int iMeasure : range(2)) {
        for (int iElement : range(4)) {
            MP mp = MP.atElement(0, iMeasure, 0, iElement);
            Chord chord = ChordTest.getChordAt(score, mp);
            assertEqualsChordLyrics(expectedLyrics[iMeasure * 4 + iElement], chord, mp);
        }
    }
}
Also used : MP(com.xenoage.zong.core.position.MP) Chord(com.xenoage.zong.core.music.chord.Chord) ChordTest(musicxmltestsuite.tests.utils.ChordTest) Test(org.junit.Test)

Aggregations

MP (com.xenoage.zong.core.position.MP)46 Test (org.junit.Test)30 Score (com.xenoage.zong.core.Score)19 Chord (com.xenoage.zong.core.music.chord.Chord)16 Voice (com.xenoage.zong.core.music.Voice)14 Rest (com.xenoage.zong.core.music.rest.Rest)11 ChordTest (musicxmltestsuite.tests.utils.ChordTest)6 Pitch (com.xenoage.zong.core.music.Pitch)4 Measure (com.xenoage.zong.core.music.Measure)3 Direction (com.xenoage.zong.core.music.direction.Direction)3 MP.atVoice (com.xenoage.zong.core.position.MP.atVoice)3 VoiceTest.assertEqualsVoice (musicxmltestsuite.tests.utils.VoiceTest.assertEqualsVoice)3 MeasureElementWrite (com.xenoage.zong.commands.core.music.MeasureElementWrite)2 VoiceElementWrite (com.xenoage.zong.commands.core.music.VoiceElementWrite)2 ColumnHeader (com.xenoage.zong.core.header.ColumnHeader)2 Staff (com.xenoage.zong.core.music.Staff)2 Beam (com.xenoage.zong.core.music.beam.Beam)2 Tempo (com.xenoage.zong.core.music.direction.Tempo)2 Position (com.xenoage.zong.core.music.format.Position)2 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)2