Search in sources :

Example 1 with ToDo

use of musicxmltestsuite.tests.utils.ToDo in project Zong by Xenoage.

the class Test31a method test.

@ToDo("add support for multiple direction-types within a single MusicXML direction")
@Test
public void test() {
    Score score = getScore();
    // test directions
    for (Tuple2<MP, ?> item : expectedDirections) {
        MP mp = item.get1();
        List<?> directions = null;
        // in the column header instead, and not in the measure
        if (item.get2() instanceof Tempo)
            directions = score.getColumnHeader(mp.measure).getTempos().getAll(mp.beat);
        else if (item.get2() instanceof NavigationSign)
            directions = score.getColumnHeader(mp.measure).getOtherDirections().getAll(mp.beat);
        else
            directions = score.getMeasure(mp).getDirections().getAll(mp.beat);
        // check correct classes
        if (item.get2() instanceof Direction) {
            // single direction at this beat expected
            assertEquals("" + mp, 1, directions.size());
            assertEquals("" + mp, item.get2().getClass(), directions.get(0).getClass());
        } else if (item.get2() instanceof List<?>) {
        // List<?> l = (List<?>) item.get2();
        // multiple directions at this beat expected
        // TODO: add support for multiple direction-types within a single MusicXML direction
        // assertEquals(""+mp, l.size(), directions.size());
        // for (int i : range(l))
        // assertEquals(""+mp+"["+i+"]", l.get(i).getClass(), directions.get(i).getClass());
        }
    }
    // segno and coda
    assertEquals(MusicElementType.Segno, score.getColumnHeader(1).getNavigationTarget().getMusicElementType());
    assertEquals(MusicElementType.Coda, score.getColumnHeader(1).getNavigationOrigin().getMusicElementType());
}
Also used : Score(com.xenoage.zong.core.Score) MP(com.xenoage.zong.core.position.MP) Tempo(com.xenoage.zong.core.music.direction.Tempo) NavigationSign(com.xenoage.zong.core.music.direction.NavigationSign) Direction(com.xenoage.zong.core.music.direction.Direction) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Example 2 with ToDo

use of musicxmltestsuite.tests.utils.ToDo in project Zong by Xenoage.

the class Test02a method test.

@ToDo("multirests are not supported yet")
@Test
public void test() {
    MxlPart part = getFirstPart();
    int iDuration = 0;
    // from MusicXML file
    int divisions = 64;
    for (int iM = 0; iM < part.getMeasures().size(); iM++) {
        MxlMeasure measure = part.getMeasures().get(iM);
        for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
            if (data.getMusicDataContentType() == MxlMusicDataContentType.Note) {
                // check type and duration
                MxlNormalNote note = (MxlNormalNote) ((MxlNote) data).getContent();
                assertEquals(MxlFullNoteContentType.Rest, note.getFullNote().getContent().getFullNoteContentType());
                assertEquals("rest " + iDuration, expectedDurations[iDuration++], Companion.fr(note.getDuration(), divisions * 4));
            }
        }
    }
    assertEquals("not all rests found", expectedDurations.length, iDuration);
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) MxlNormalNote(com.xenoage.zong.musicxml.types.choice.MxlNormalNote) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Example 3 with ToDo

use of musicxmltestsuite.tests.utils.ToDo in project Zong by Xenoage.

the class Test03a method test.

@ToDo("multiple-rest not yet supported")
@Test
public void test() {
    MxlPart part = getFirstPart();
    int iDuration = 0;
    // from MusicXML file
    int divisions = 64;
    for (int iM = 0; iM < part.getMeasures().size(); iM++) {
        MxlMeasure measure = part.getMeasures().get(iM);
        for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
            if (data.getMusicDataContentType() == MxlMusicDataContentType.Note) {
                // check type and duration
                MxlNormalNote note = (MxlNormalNote) ((MxlNote) data).getContent();
                assertEquals(MxlFullNoteContentType.Pitch, note.getFullNote().getContent().getFullNoteContentType());
                assertEquals("note " + iDuration, expectedDurations[iDuration++], Companion.fr(note.getDuration(), divisions * 4));
            }
        }
    }
    assertEquals("not all notes found", expectedDurations.length, iDuration);
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) MxlNormalNote(com.xenoage.zong.musicxml.types.choice.MxlNormalNote) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Example 4 with ToDo

use of musicxmltestsuite.tests.utils.ToDo in project Zong by Xenoage.

the class Test13a method test.

@ToDo("Zong! supports only -7 to +7, starting in measure 9, ending in measure 38")
@Test
public void test() {
    MxlPart part = getFirstPart();
    TraditionalKey[] expectedKeys = getExpectedKeys();
    int iKey = 0;
    for (int i = 8; i <= 37; i++) {
        MxlMeasure measure = part.getMeasures().get(i);
        for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
            if (data.getMusicDataContentType() == MxlMusicDataContentType.Attributes) {
                // check type
                MxlAttributes attr = (MxlAttributes) data;
                MxlKey key = attr.getKey();
                assertEquals(expectedKeys[iKey].getFifths(), key.getFifths());
                assertEquals(expectedKeys[iKey].getMode(), getEnumValue("" + key.getMode(), Mode.values()));
                iKey++;
            }
        }
    }
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlAttributes(com.xenoage.zong.musicxml.types.MxlAttributes) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) MxlKey(com.xenoage.zong.musicxml.types.MxlKey) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Example 5 with ToDo

use of musicxmltestsuite.tests.utils.ToDo in project Zong by Xenoage.

the class Test01a method test.

@ToDo("the editiorial sharp (sharp in parenthesis) in the last measure is not supported yet")
@Test
public void test() {
    Pitch[] expectedPitches = getExpectedPitches();
    Staff staff = getFirstStaff();
    assertEquals(26, staff.getMeasures().size());
    int iPitch = 0;
    for (int iM = 0; iM < staff.getMeasures().size(); iM++) {
        Measure measure = staff.getMeasures().get(iM);
        Voice voice = measure.getVoice(0);
        for (VoiceElement e : voice.getElements()) {
            if (e instanceof Chord) {
                // check note and pitch
                Chord chord = (Chord) e;
                assertEquals(expectedPitches[iPitch++], chord.getNotes().get(0).getPitch());
            }
        }
    }
    assertEquals("not all notes found", expectedPitches.length, iPitch);
}
Also used : VoiceElement(com.xenoage.zong.core.music.VoiceElement) Staff(com.xenoage.zong.core.music.Staff) Pitch(com.xenoage.zong.core.music.Pitch) Measure(com.xenoage.zong.core.music.Measure) Voice(com.xenoage.zong.core.music.Voice) Chord(com.xenoage.zong.core.music.chord.Chord) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Aggregations

ToDo (musicxmltestsuite.tests.utils.ToDo)7 Test (org.junit.Test)7 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)4 MxlMeasure (com.xenoage.zong.musicxml.types.partwise.MxlMeasure)4 MxlPart (com.xenoage.zong.musicxml.types.partwise.MxlPart)4 Measure (com.xenoage.zong.core.music.Measure)2 Pitch (com.xenoage.zong.core.music.Pitch)2 Staff (com.xenoage.zong.core.music.Staff)2 Voice (com.xenoage.zong.core.music.Voice)2 VoiceElement (com.xenoage.zong.core.music.VoiceElement)2 Chord (com.xenoage.zong.core.music.chord.Chord)2 MxlNormalNote (com.xenoage.zong.musicxml.types.choice.MxlNormalNote)2 Score (com.xenoage.zong.core.Score)1 Direction (com.xenoage.zong.core.music.direction.Direction)1 NavigationSign (com.xenoage.zong.core.music.direction.NavigationSign)1 Tempo (com.xenoage.zong.core.music.direction.Tempo)1 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)1 MP (com.xenoage.zong.core.position.MP)1 ScoreFrameLayout (com.xenoage.zong.musiclayout.ScoreFrameLayout)1 MxlAttributes (com.xenoage.zong.musicxml.types.MxlAttributes)1