use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.
the class RepetitionsFinderTest method testRepeatsWithinVoltas.
/**
* Test case with repeats within voltas:
* _______________ ___
* voltas: 1 2
* measures: | | |: | :| :| ||
* numbers: |0 |1 |2 |3 |4 |5 ||
*/
@Test
public void testRepeatsWithinVoltas() {
score = ScoreFactory.create1Staff();
new MeasureAdd(score, 5).execute();
writeVolta(1, 4, range(1, 1));
writeForwardRepeat(2);
writeBackwardRepeat(3, 1);
writeBackwardRepeat(4, 1);
writeVolta(5, 1, range(2, 2));
val expectedRepetitions = new Repetitions(ilist(repetition(0, 4), repetition(2, 5), repetition(0, 1), repetition(5, 6)));
runTest(new TestCase(score, expectedRepetitions));
}
use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.
the class RepetitionsFinderTest method testAdvanced.
/**
* A more advanced test case with the following repetitions:
* ____ ________ ________________ ___ ___
* voltas/repeats: 2x 1+2 3 4 senzarep 1 2
* measures: | |(segno) |: | | :| | |(tocoda) |: | :| | :| | (dalsegno)|(coda) |: | :| ||
* numbers: |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 |12 |13 |14 |15 |16 |17 ||
*/
@Test
public void testAdvanced() {
score = ScoreFactory.create1Staff();
new MeasureAdd(score, 17).execute();
writeNavigationTarget(1, new Segno());
writeForwardRepeat(2);
writeBackwardRepeat(4, 2);
writeNavigationOrigin(6, new Coda());
writeForwardRepeat(8);
writeVolta(9, 1, range(1, 2));
writeBackwardRepeat(9, 2);
writeVolta(10, 2, range(3, 3));
writeBackwardRepeat(11, 1);
writeVolta(12, 2, range(4, 4));
writeNavigationOrigin(13, segno(false));
writeNavigationTarget(14, new Coda());
writeForwardRepeat(15);
writeVolta(16, 1, range(1, 1));
writeBackwardRepeat(16, 1);
writeVolta(17, 1, range(2, 2));
val expectedRepetitions = new Repetitions(ilist(repetition(0, 5), repetition(2, 5), repetition(2, 10), repetition(8, 10), repetition(8, 9), repetition(10, 12), repetition(8, 9), // -> dal segno senza rep
repetition(12, 14), repetition(1, 7), repetition(14, 17), repetition(15, 16), repetition(17, 18)));
runTest(new TestCase(score, expectedRepetitions));
}
use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.
the class VoltaGroupFinderTest method createScore.
private Score createScore() {
Score score = ScoreFactory.create1Staff();
new MeasureAdd(score, getLast(getLast(voltaGroups)) + 4).execute();
for (val voltaGroup : voltaGroups) {
for (int iVolta = 0; iVolta < voltaGroup.length - 1; iVolta++) {
int startMeasure = voltaGroup[iVolta];
int length = voltaGroup[iVolta + 1] - voltaGroup[iVolta];
val numbers = range(iVolta + 1, iVolta + 1);
score.getHeader().getColumnHeader(startMeasure).setVolta(new Volta(length, numbers, numbers.toString(), false));
}
}
return score;
}
Aggregations