use of com.xenoage.zong.core.music.VoiceElement in project Zong by Xenoage.
the class Test24a method testBeams.
@Test
public void testBeams() {
Staff staff = getFirstStaff();
int iChord = 0;
Beam currentBeam = null;
for (int iM = 0; iM < staff.getMeasures().size(); iM++) {
Voice voice = staff.getMeasure(iM).getVoice(0);
for (VoiceElement e : voice.getElements()) {
Chord expectedChord = expectedChords[iChord];
// beams between chord 2 and 3 and between 11 and 12
if (iChord == 2 || iChord == 11) {
assertNotNull("chord " + iChord + " unbeamed", expectedChord.getBeam());
assertEquals("chord " + iChord, WaypointPosition.Start, expectedChord.getBeam().getWaypointPosition(expectedChord));
currentBeam = expectedChord.getBeam();
} else if (iChord == 3 || iChord == 12) {
assertNotNull("chord " + iChord + " unbeamed", expectedChord.getBeam());
assertEquals("wrong beam", currentBeam, expectedChord.getBeam());
assertEquals("chord " + iChord, WaypointPosition.Stop, expectedChord.getBeam().getWaypointPosition(expectedChord));
currentBeam = null;
} else {
assertNull("chord " + iChord + " beamed", expectedChord.getBeam());
}
iChord++;
}
}
assertEquals("not all chords found", expectedChords.length, iChord);
}
use of com.xenoage.zong.core.music.VoiceElement 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);
}
use of com.xenoage.zong.core.music.VoiceElement in project Zong by Xenoage.
the class Test01b method test.
@Test
public void test() {
Pitch[] expectedPitches = getExpectedPitches();
int iPitch = 0;
Staff staff = getFirstStaff();
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());
}
}
}
// TODO - ignore this test, since MusicXML input file has a bug (only a single measure),
// so currently only the first measure is tested
// assertEquals("not all notes found", expectedPitches.length, iPitch);
}
use of com.xenoage.zong.core.music.VoiceElement 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() {
int[] expectedLPs = getExpectedLPs();
Staff staff = getFirstStaff();
ScoreFrameLayout scoreFrameLayout = getScoreFrameLayout();
int chordIndex = 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 LP
// TODO
}
}
}
}
use of com.xenoage.zong.core.music.VoiceElement in project Zong by Xenoage.
the class Test01c method test.
@Test
public void test() {
Voice voice = getScore().getVoice(mp0);
for (VoiceElement e : voice.getElements()) {
if (e instanceof Chord) {
Chord chord = (Chord) e;
// check pitch
assertEquals(Companion.pi('G', 0, 4), chord.getNotes().get(0).getPitch());
// check lyric
assertEquals(1, chord.getLyrics().size());
assertEquals("A", chord.getLyrics().get(0).getText().toString());
return;
}
}
fail("note not found");
}
Aggregations