示例#1
0
 // mergePlayEmptyTest(): m1 and/or m2 empty
 @Test
 public void mergePlayEmptyTest() {
   Merge a = new Merge(new Rest(0), new Rest(0));
   try {
     SequencePlayer player = new SequencePlayer(140, 12);
     a.play(player, 0);
     assertEquals("Meta event: END_OF_TRACK Tick: 0\n", player.toString());
   } catch (MidiUnavailableException mue) {
     mue.printStackTrace();
   } catch (InvalidMidiDataException imde) {
     imde.printStackTrace();
   }
 }
示例#2
0
 // mergePlayEqualsTest(): m1 = m2
 @Test
 public void mergePlayEqualsTest() {
   Merge a = new Merge(new Note(1.0, new Pitch('C')), new Note(1.0, new Pitch('C')));
   try {
     SequencePlayer player = new SequencePlayer(140, 12);
     a.play(player, 0);
     assertEquals(
         "Event: NOTE_ON  Pitch: 60  Tick: 0\n"
             + "Event: NOTE_OFF Pitch: 60  Tick: 12\n"
             + "Event: NOTE_ON  Pitch: 60  Tick: 12\n"
             + "Event: NOTE_OFF Pitch: 60  Tick: 24\n"
             + "Meta event: END_OF_TRACK Tick: 24\n",
         player.toString());
   } catch (MidiUnavailableException mue) {
     mue.printStackTrace();
   } catch (InvalidMidiDataException imde) {
     imde.printStackTrace();
   }
 }
示例#3
0
 // mergeDifferentDurationTest(): m1, m2 different duration
 @Test
 public void mergeDifferentDurationTest() {
   Merge a = new Merge(new Rest(1), new Note(5, new Pitch('A')));
   assertTrue(6 == a.duration());
 }
示例#4
0
 // mergeSameDurationTest(): m1, m2 same duration
 @Test
 public void mergeSameDurationTest() {
   Merge a = new Merge(new Rest(5), new Note(5, new Pitch('A')));
   assertTrue(10 == a.duration());
 }
示例#5
0
 // mergeEmptyTest(): m1 and/or m2 empty
 @Test
 public void mergeEmptyTest() {
   Merge a = new Merge(new Rest(0), new Rest(0));
   assertEquals(".0.0 .0.0", a.toString());
 }
示例#6
0
 // mergeConstructorTest()
 @Test
 public void mergeConstructorTest() {
   Merge a = new Merge(new Note(2., new Pitch('C')), new Note(1., new Pitch('F')));
   assertEquals("C2.0 F1.0", a.toString());
 }
示例#7
0
 // mergeToStringDifferentTest(): m1 and m2 non-equals
 @Test
 public void mergeToStringDifferentTest() {
   Merge a = new Merge(new Note(2, new Pitch('C')), new Note(5, new Pitch('A')));
   assertEquals("C2.0 A5.0", a.toString());
 }
示例#8
0
 // mergeToStringEqualsTest(): m1 and m2 equals
 @Test
 public void mergeToStringEqualsTest() {
   Merge a = new Merge(new Note(5, new Pitch('A')), new Note(5, new Pitch('A')));
   assertEquals("A5.0 A5.0", a.toString());
 }