Search in sources :

Example 21 with MP

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

the class Test32b method getFontSize.

private float getFontSize(Score score, int wordsIndex) {
    MP mp = expectedTexts.get(wordsIndex).get1();
    FormattedText text = getTextAt(score, mp);
    return getFontSize(text);
}
Also used : MP(com.xenoage.zong.core.position.MP) FormattedText(com.xenoage.zong.core.text.FormattedText)

Example 22 with MP

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

the class Test32b method testStyle.

@Test
public void testStyle() {
    Score score = getScore();
    for (int i = 0; i < expectedTexts.size(); ) {
        MP mp = expectedTexts.get(i).get1();
        List<Direction> directions = score.getMeasure(mp).getDirections().getAll(mp.beat);
        assertTrue("" + mp, directions.size() > 0);
        for (val direction : directions) {
            assertTrue("" + mp, direction instanceof Words);
            check((Words) direction, expectedTexts.get(i).get2(), mp);
            i++;
        }
    }
}
Also used : lombok.val(lombok.val) Score(com.xenoage.zong.core.Score) MP(com.xenoage.zong.core.position.MP) Words(com.xenoage.zong.core.music.direction.Words) Direction(com.xenoage.zong.core.music.direction.Direction) Test(org.junit.Test)

Example 23 with MP

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

the class Test13b method test.

@Test
public void test() {
    Score score = getScore();
    TraditionalKey[] expectedKeys = getExpectedKeys();
    MP mp = mp0;
    for (int iKey : range(expectedKeys)) {
        ColumnHeader column = score.getColumnHeader(mp.measure);
        TraditionalKey key = (TraditionalKey) column.getKeys().get(mp.beat);
        assertNotNull("mp " + mp, key);
        assertEquals("mp " + mp, expectedKeys[iKey].getFifths(), key.getFifths());
        assertEquals("mp " + mp, expectedKeys[iKey].getMode(), key.getMode());
        mp = mp.withBeat(mp.beat.add(Companion.fr(1, 4)));
        if (mp.beat.compareTo(Companion.get_1()) >= 0) {
            mp = mp.withMeasure(mp.measure + 1).withBeat(Companion.get_0());
        }
    }
}
Also used : Score(com.xenoage.zong.core.Score) ColumnHeader(com.xenoage.zong.core.header.ColumnHeader) MP(com.xenoage.zong.core.position.MP) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Test(org.junit.Test)

Example 24 with MP

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

the class Test21b method test.

@Test
public void test() {
    Score score = getScore();
    MP mp = mp0;
    for (int i = 0; i < expectedChordsCount; i++) {
        Chord chord = (Chord) score.getVoice(mp).getElementAt(mp.beat);
        assertEquals(expectedChord.getNotes(), chord.getNotes());
        assertEquals(expectedChord.getDuration(), chord.getDuration());
        mp = mp.withBeat(mp.beat.add(Companion.fr(1, 4)));
        if (mp.beat.compareTo(Companion.get_1()) >= 0) {
            mp = mp.withMeasure(mp.measure + 1).withBeat(Companion.get_0());
        }
    }
}
Also used : Score(com.xenoage.zong.core.Score) MP(com.xenoage.zong.core.position.MP) Chord(com.xenoage.zong.core.music.chord.Chord) Test(org.junit.Test)

Example 25 with MP

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

the class Test42a method test.

@Test
public void test() {
    Staff staff = getFirstStaff();
    // test chords
    for (int iMeasure : range(2)) {
        for (int iVoice : range(2)) {
            MP mpVoice = atVoice(0, iMeasure, iVoice);
            Voice expectedVoice = expectedStaff.getVoice(mpVoice);
            Voice voice = staff.getVoice(mpVoice);
            assertEqualsVoice(expectedVoice, voice, mpVoice);
        }
    }
    // test slurs
    assertSlurBetween(getVoiceChords(staff.getVoice(atVoice(0, 1, 0))), 1, 2, SlurType.Slur);
    assertSlurBetween(getVoiceChords(staff.getVoice(atVoice(0, 1, 1))), 1, 2, SlurType.Slur);
}
Also used : MP(com.xenoage.zong.core.position.MP) Staff(com.xenoage.zong.core.music.Staff) VoiceTest.assertEqualsVoice(musicxmltestsuite.tests.utils.VoiceTest.assertEqualsVoice) MP.atVoice(com.xenoage.zong.core.position.MP.atVoice) Voice(com.xenoage.zong.core.music.Voice) 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