Search in sources :

Example 1 with Tempo

use of com.xenoage.zong.core.music.direction.Tempo 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 Tempo

use of com.xenoage.zong.core.music.direction.Tempo in project Zong by Xenoage.

the class Test31c method test.

@Test
public void test() {
    Score score = getScore();
    for (Tuple2<MP, Tempo> tempo : expectedTempos) {
        MP mp = tempo.get1();
        List<Tempo> temposAtBeat = score.getColumnHeader(mp.measure).getTempos().getAll(mp.beat);
        assertEquals(1, temposAtBeat.size());
        // TODO: add equals for tempo
        assertEquals(tempo.get2().getBaseBeat(), temposAtBeat.get(0).getBaseBeat());
        assertEquals(tempo.get2().getBeatsPerMinute(), temposAtBeat.get(0).getBeatsPerMinute());
    }
}
Also used : Score(com.xenoage.zong.core.Score) MP(com.xenoage.zong.core.position.MP) Tempo(com.xenoage.zong.core.music.direction.Tempo) Test(org.junit.Test)

Aggregations

Score (com.xenoage.zong.core.Score)2 Tempo (com.xenoage.zong.core.music.direction.Tempo)2 MP (com.xenoage.zong.core.position.MP)2 Test (org.junit.Test)2 Direction (com.xenoage.zong.core.music.direction.Direction)1 NavigationSign (com.xenoage.zong.core.music.direction.NavigationSign)1 ToDo (musicxmltestsuite.tests.utils.ToDo)1