Search in sources :

Example 1 with MxlKey

use of com.xenoage.zong.musicxml.types.MxlKey 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 2 with MxlKey

use of com.xenoage.zong.musicxml.types.MxlKey in project Zong by Xenoage.

the class Test13b method test.

@Test
public void test() {
    TraditionalKey[] expectedKeys = getExpectedKeys();
    MxlPart part = getFirstPart();
    int iKey = 0;
    for (int i = 0; i <= 2; 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++;
                if (iKey >= expectedKeys.length)
                    break;
            }
        }
    }
    assertEquals("not all keys found", expectedKeys.length, 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) Test(org.junit.Test)

Aggregations

TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)2 MxlAttributes (com.xenoage.zong.musicxml.types.MxlAttributes)2 MxlKey (com.xenoage.zong.musicxml.types.MxlKey)2 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)2 MxlMeasure (com.xenoage.zong.musicxml.types.partwise.MxlMeasure)2 MxlPart (com.xenoage.zong.musicxml.types.partwise.MxlPart)2 Test (org.junit.Test)2 ToDo (musicxmltestsuite.tests.utils.ToDo)1