use of com.xenoage.zong.core.Score 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());
}
}
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test11a method test.
@Test
public void test() {
Score score = getScore();
int iTime = 0;
for (int iM = 0; iM < score.getMeasuresCount(); iM++) {
// TODO: first time is wrong in MusicXML file - ignore
if (iTime == 0) {
iTime++;
continue;
}
// check time
assertEquals("element " + iTime, expectedTimes[iTime++], score.getColumnHeader(iM).getTime().getType());
}
assertEquals("not all times found", expectedTimes.length, iTime);
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test11h method test.
@Test
public void test() {
Score score = getScore();
// time signature must be senza misura
assertEquals(TimeType.Companion.getTimeSenzaMisura(), score.getColumnHeader(0).getTime().getType());
// measure must contain 3 notes and have a length of 3/8
assertEquals(3, score.getVoice(mp0).getElements().size());
assertEquals(Companion.fr(3, 8), score.getVoice(mp0).getFilledBeats());
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test12b method test.
@Test
public void test() {
Score score = getScore();
// musical context must be 4/4, C clef and no accidentals
MusicContext context = score.getMusicContext(mp0, Interval.At, Interval.At);
assertEquals(Companion.fr(4, 4), score.getMeasureBeats(0));
assertEquals(ClefType.Companion.getClefTreble(), context.getClef());
for (int i = 0; i < 7; i++) assertEquals(0, context.getKey().getAlterations()[i]);
// there should be a C clef in the first measure
assertEquals(ClefType.Companion.getClefTreble(), score.getMeasure(mp0).getClefs().get(Companion.get_0()).getType());
// there should be a time signature and key signature in the measure column
ColumnHeader header = score.getHeader().getColumnHeader(0);
assertEquals(TimeType.Companion.getTime_4_4(), header.getTime().getType());
assertNotNull(header.getKeys().get(Companion.get_0()));
}
use of com.xenoage.zong.core.Score in project Zong by Xenoage.
the class Test33b method test.
@Test
public void test() {
Score score = getScore();
Chord chord1 = (Chord) score.getVoice(atVoice(0, 0, 0)).getElement(0);
Chord chord2 = (Chord) score.getVoice(atVoice(0, 1, 0)).getElement(0);
assertEquals(1, chord1.getSlurs().size());
Slur tie = chord1.getSlurs().get(0);
assertEquals(SlurType.Tie, tie.getType());
List<SlurWaypoint> waypoints = tie.getWaypoints();
assertEquals(2, waypoints.size());
assertEquals(chord1, waypoints.get(0).getChord());
assertEquals(chord2, waypoints.get(1).getChord());
}
Aggregations