harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r427416 - in /incubator/harmony/enhanced/classlib/trunk/modules/sound/src: main/java/javax/sound/midi/MidiEvent.java test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
Date Tue, 01 Aug 2006 03:03:45 GMT
Author: smishura
Date: Mon Jul 31 20:03:44 2006
New Revision: 427416

URL: http://svn.apache.org/viewvc?rev=427416&view=rev
Log:
Apply patch for HARMONY-1017 ([classlib][sound] Class MidiEvent and test MidiEventTest)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/midi/MidiEvent.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/midi/MidiEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/midi/MidiEvent.java?rev=427416&r1=427415&r2=427416&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/midi/MidiEvent.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/midi/MidiEvent.java
Mon Jul 31 20:03:44 2006
@@ -17,21 +17,24 @@
 package javax.sound.midi;
 
 public class MidiEvent {
+    private MidiMessage message;
+    
+    private long tick;
+    
     public MidiEvent(MidiMessage message, long tick) {
-        //TODO
+        this.message = message;
+        this.tick = tick;
     }
 
     public MidiMessage getMessage() {
-        //TODO
-        return null;
+        return message;
     }
 
     public long getTick() {
-        //TODO
-        return 1L;
+        return tick;
     }
 
     public void setTick(long tick) {
-        //TODO
+        this.tick = tick;
     }
 }

Added: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java?rev=427416&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
Mon Jul 31 20:03:44 2006
@@ -0,0 +1,71 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.sound.tests.javax.sound.midi;
+
+import javax.sound.midi.MidiEvent;
+import javax.sound.midi.MidiMessage;
+
+import junit.framework.TestCase;
+
+public class MidiEventTest extends TestCase {
+    public void test_getMessage() {
+        byte[] bt = new byte[] {1, 2, 3, 4};
+        MidiMessage1 message = new MidiMessage1(bt);
+        MidiEvent event = new MidiEvent(message, 10L);
+        MidiMessage mm = event.getMessage();
+        assertEquals(1, mm.getMessage()[0]);
+        assertEquals(2, mm.getMessage()[1]);
+        assertEquals(3, mm.getMessage()[2]);
+        assertEquals(4, mm.getMessage()[3]);
+        bt[0] = 10;
+        bt[1] = 20;
+        bt[2] = 30;
+        bt[3] = 40;
+        /*
+         * values change
+         */
+        assertEquals(10, mm.getMessage()[0]);
+        assertEquals(20, mm.getMessage()[1]);
+        assertEquals(30, mm.getMessage()[2]);
+        assertEquals(40, mm.getMessage()[3]);
+        byte[] nb = mm.getMessage();
+        nb[0] = 45;
+        nb[1] = -12;
+        nb[2] = 90;
+        nb[3] = 14;
+        /*
+         * values don't change
+         */
+        assertEquals(10, mm.getMessage()[0]);
+        assertEquals(20, mm.getMessage()[1]);
+        assertEquals(30, mm.getMessage()[2]);
+        assertEquals(40, mm.getMessage()[3]);
+        
+        MidiEvent event1 = new MidiEvent(null, 10L);
+        assertNull(event1.getMessage());
+    }
+    
+    static class MidiMessage1 extends MidiMessage {
+        public MidiMessage1(byte[] data) {
+            super(data);
+        }
+        
+        public Object clone() {
+            return null;
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/midi/MidiEventTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message