use of com.xenoage.zong.core.Score 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() {
Score score = getScore();
TraditionalKey[] expectedKeys = getExpectedKeys();
int iKey = 0;
for (int i = 8; i <= 37; i++) {
ColumnHeader column = score.getColumnHeader(i);
TraditionalKey key = (TraditionalKey) column.getKeys().get(Companion.get_0());
assertEquals("measure " + i, expectedKeys[iKey].getFifths(), key.getFifths());
assertEquals("measure " + i, expectedKeys[iKey].getMode(), key.getMode());
iKey++;
}
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test21c method test.
@Test
public void test() {
Score score = getScore();
MP mp = mp0;
for (int i = 0; i < expectedChords.length; i++) {
Chord chord = (Chord) score.getVoice(mp).getElementAt(mp.beat);
assertEquals("chord " + i, expectedChords[i].getNotes(), chord.getNotes());
assertEquals("chord " + i, expectedChords[i].getDuration(), chord.getDuration());
mp = mp.withBeat(mp.beat.add(expectedChords[i].getDuration()));
if (mp.beat.compareTo(Companion.get_1()) >= 0) {
mp = mp.withMeasure(mp.measure + 1).withBeat(Companion.get_0());
}
}
}
use of com.xenoage.zong.core.Score 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());
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test21f method test.
@Test
public void test() {
Score score = getScore();
// 1/4 with 3 notes at beat 0
List<VoiceElement> e = score.getVoice(mp0).getElements();
Chord chord = (Chord) e.get(0);
assertEquals(3, chord.getNotes().size());
assertEquals(Companion.fr(1, 4), chord.getDuration());
// followed by 2 rests, 1/4 and 2/4
assertEquals(Companion.fr(1, 4), ((Rest) e.get(1)).getDuration());
assertEquals(Companion.fr(2, 4), ((Rest) e.get(2)).getDuration());
// segno at beat 1/4 in column (moved to the end of the measure, since we accept no mid-measure segnos)
Direction segno = (Segno) score.getColumnHeader(0).getNavigationOrigin();
assertNotNull(segno);
// dynamics p at beat 1/4 in measure
Dynamic dynamics = (Dynamic) score.getMeasure(mp0).getDirections().get(Companion.fr(1, 4));
assertNotNull(dynamics);
assertEquals(DynamicValue.p, dynamics.getValue());
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test23f method test.
@Test
public void test() {
Score score = getScore();
checkDurations(score.getStaff(0), expectedDurations[0]);
checkDurations(score.getStaff(1), expectedDurations[1]);
}
Aggregations