harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r482518 - in /harmony/enhanced/classlib/trunk/modules/sound/src: main/java/javax/sound/sampled/ test/java/org/apache/harmony/sound/tests/javax/sound/sampled/
Date Tue, 05 Dec 2006 06:29:37 GMT
Author: smishura
Date: Mon Dec  4 22:29:36 2006
New Revision: 482518

URL: http://svn.apache.org/viewvc?view=rev&rev=482518
Log:
Apply patch for HARMONY-2401 ([classlib][sound] javax.sound.sampled FloatControl, Port.Info,
Mixer.Info, ReverbType, and LineEvent api implementation)

Added:
    harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/FloatControlTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/LineEventTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/MixerTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/PortInfoTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/ReverbTypeTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/FloatControl.java
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Mixer.java
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Port.java
    harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/ReverbType.java

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/FloatControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/FloatControl.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/FloatControl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/FloatControl.java
Mon Dec  4 22:29:36 2006
@@ -17,34 +17,50 @@
 
 package javax.sound.sampled;
 
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public abstract class FloatControl extends Control {
 
     public static class Type extends Control.Type {
-        public static final Type MASTER_GAIN = new Type("MASTER_GAIN");
+        public static final Type MASTER_GAIN = new Type("Master Gain"); //$NON-NLS-1$
 
-        public static final Type AUX_SEND = new Type("AUX_SEND");
+        public static final Type AUX_SEND = new Type("AUX Send"); //$NON-NLS-1$
 
-        public static final Type AUX_RETURN = new Type("AUX_RETURN");
+        public static final Type AUX_RETURN = new Type("AUX Return"); //$NON-NLS-1$
 
-        public static final Type REVERB_SEND = new Type("REVERB_SEND");
+        public static final Type REVERB_SEND = new Type("Reverb Send"); //$NON-NLS-1$
 
-        public static final Type REVERB_RETURN = new Type("REVERB_RETURN");
+        public static final Type REVERB_RETURN = new Type("Reverb Return"); //$NON-NLS-1$
 
-        public static final Type VOLUME = new Type("VOLUME");
+        public static final Type VOLUME = new Type("Volume"); //$NON-NLS-1$
 
-        public static final Type PAN = new Type("PAN");
+        public static final Type PAN = new Type("Pan"); //$NON-NLS-1$
 
-        public static final Type BALANCE = new Type("BALANCE");
+        public static final Type BALANCE = new Type("Balance"); //$NON-NLS-1$
 
-        public static final Type SAMPLE_RATE = new Type("SAMPLE_RATE");
+        public static final Type SAMPLE_RATE = new Type("Sample Rate"); //$NON-NLS-1$
 
         protected Type(String name) {
             super(name);
         }
     }
 
+    private float value;
+
+    private float maximum;
+
+    private float minimum;
+
+    private String units;
+
+    private String minLabel;
+
+    private String midLabel;
+
+    private String maxLabel;
+
+    private float precision;
+
+    private int updatePeriod;
+
     protected FloatControl(FloatControl.Type type, float minimum,
             float maximum, float precision, int updatePeriod,
             float initialValue, String units, String minLabel, String midLabel,
@@ -64,37 +80,14 @@
     protected FloatControl(FloatControl.Type type, float minimum,
             float maximum, float precision, int updatePeriod,
             float initialValue, String units) {
-        super(type);
-        this.maximum = maximum;
-        this.maxLabel = "";
-        this.midLabel = "";
-        this.minLabel = "";
-        this.minimum = minimum;
-        this.precision = precision;
-        this.units = units;
-        this.updatePeriod = updatePeriod;
-        this.value = initialValue;
+        this(type, minimum, maximum, precision, updatePeriod, initialValue,
+                units, "", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
-    private float value;
-
-    private float maximum;
-
-    private float minimum;
-
-    private String units;
-
-    private String minLabel;
-
-    private String midLabel;
-
-    private String maxLabel;
-
-    private float precision;
-
-    private int updatePeriod;
-
     public void setValue(float newValue) {
+        if (newValue > maximum || newValue < minimum) {
+            throw new IllegalArgumentException("value does not fall within the allowable
range"); //$NON-NLS-1$
+        }
         this.value = newValue;
     }
 
@@ -134,12 +127,13 @@
         return this.updatePeriod;
     }
 
-    public void shift(float from, float to, int microseconds) throws NotImplementedException
{
-        throw new NotImplementedException("not yet implemented");
+    public void shift(float from, float to, int microseconds) {
+        setValue(to);
     }
 
-    public String toString() throws NotImplementedException {
-        throw new NotImplementedException("not yet implemented");
+    public String toString() {
+        return getType() + " with current value: "+ value + " " + units  //$NON-NLS-1$ //$NON-NLS-2$
+            + " (range: " + minimum + " - " + maximum + ")"; //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
Mon Dec  4 22:29:36 2006
@@ -17,8 +17,6 @@
 
 package javax.sound.sampled;
 
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public interface Line {
 
     class Info {
@@ -37,8 +35,8 @@
         }
         
         @Override
-        public String toString() throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public String toString() {
+            return lineClass.toString();
         }
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java
Mon Dec  4 22:29:36 2006
@@ -25,6 +25,9 @@
      * 
      */
     private static final long serialVersionUID = -1274246333383880410L;
+    
+    private LineEvent.Type type;
+    private long position;
 
     public static class Type {
 
@@ -69,6 +72,23 @@
 
     public LineEvent(Line line, LineEvent.Type type, long position) {
         super(line);
-        throw new Error("Not yet imlemented");
+        this.type = type;
+        this.position = position;
+    }
+    
+    public final Line getLine() {
+        return (Line)getSource();
+    }
+    
+    public final LineEvent.Type getType() {
+        return type;
+    }
+    
+    public final long getFramePosition() {
+        return position;
+    }
+    
+    public String toString() {
+        return type + " event from line " + getLine(); //$NON-NLS-1$
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Mixer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Mixer.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Mixer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Mixer.java
Mon Dec  4 22:29:36 2006
@@ -17,8 +17,6 @@
 
 package javax.sound.sampled;
 
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public interface Mixer extends Line {
     static class Info{
         private String name;
@@ -26,7 +24,7 @@
         private String description;
         private String version;        
         
-        public Info(String name, String vendor, String description, String version) {
+        protected Info(String name, String vendor, String description, String version) {
             this.name = name;
             this.vendor = vendor;
             this.description = description;
@@ -60,8 +58,8 @@
         }
         
         @Override
-        public String toString() throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public String toString() {
+            return name + ", version " + version; //$NON-NLS-1$
         }
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Port.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Port.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Port.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Port.java
Mon Dec  4 22:29:36 2006
@@ -17,10 +17,6 @@
 
 package javax.sound.sampled;
 
-import javax.sound.sampled.Line;
-
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public interface Port extends Line {
 
     public static class Info extends Line.Info {
@@ -30,20 +26,20 @@
         private boolean isSource;
 
         public static final Info MICROPHONE = new Info(Port.class,
-                "MICROPHONE", true);
+                "MICROPHONE", true); //$NON-NLS-1$
 
-        public static final Info LINE_IN = new Info(Port.class, "LINE_IN", true);
+        public static final Info LINE_IN = new Info(Port.class, "LINE_IN", true); //$NON-NLS-1$
 
         public static final Info COMPACT_DISC = new Info(Port.class,
-                "COMPACT_DISC", true);
+                "COMPACT_DISC", true); //$NON-NLS-1$
 
-        public static final Info SPEAKER = new Info(Port.class, "SPEAKER",
+        public static final Info SPEAKER = new Info(Port.class, "SPEAKER", //$NON-NLS-1$
                 false);
 
-        public static final Info HEADPHONE = new Info(Port.class, "HEADPHONES",
+        public static final Info HEADPHONE = new Info(Port.class, "HEADPHONES", //$NON-NLS-1$
                 false);
 
-        public static final Info LINE_OUT = new Info(Port.class, "LINE_OUT",
+        public static final Info LINE_OUT = new Info(Port.class, "LINE_OUT", //$NON-NLS-1$
                 false);
 
         public Info(Class<?> lineClass, String name, boolean isSource) {
@@ -60,20 +56,25 @@
             return this.isSource;
         }
 
-        public boolean matches(Line.Info info) throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public boolean matches(Line.Info info) {
+            if (super.matches(info) && Port.Info.class.equals(info.getClass())
+                    && name.equals(((Port.Info) info).getName())
+                    && isSource == ((Port.Info) info).isSource()) {
+                return true;
+            }
+            return false;
         }
 
-        public final boolean equals(Object obj) throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public final boolean equals(Object obj) {
+            return this == obj;
         }
 
-        public final int hashCode() throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public final int hashCode() {
+            return name.hashCode() ^ getLineClass().hashCode();
         }
 
-        public final String toString() throws NotImplementedException {
-            throw new NotImplementedException("not yet implemented");
+        public final String toString() {
+            return name + (isSource ? " source port" : " target port"); //$NON-NLS-1$ //$NON-NLS-2$
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/ReverbType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/ReverbType.java?view=diff&rev=482518&r1=482517&r2=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/ReverbType.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/ReverbType.java
Mon Dec  4 22:29:36 2006
@@ -17,8 +17,6 @@
 
 package javax.sound.sampled;
 
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public class ReverbType {
 
     protected ReverbType(String name, int earlyReflectionDelay,
@@ -68,15 +66,19 @@
         return this.decayTime;
     }
 
-    public final boolean equals(Object obj) throws NotImplementedException {
-        throw new NotImplementedException("not yet implemented");
+    public final boolean equals(Object obj) {
+        return this == obj;
     }
 
-    public final int hashCode() throws NotImplementedException {
-        throw new NotImplementedException("not yet implemented");
+    public final int hashCode() {
+        return toString().hashCode();
     }
 
-    public final String toString() throws NotImplementedException {
-        throw new NotImplementedException("not yet implemented");
+    public final String toString() {
+        return name + ", early reflection delay " + earlyReflectionDelay //$NON-NLS-1$
+                + " ns, early reflection intensity " + earlyReflectionIntensity //$NON-NLS-1$
+                + " dB, late deflection delay " + lateReflectionDelay //$NON-NLS-1$
+                + " ns, late reflection intensity " + lateReflectionIntensity //$NON-NLS-1$
+                + " dB, decay time " + decayTime; //$NON-NLS-1$
     }
 }

Added: harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/FloatControlTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/FloatControlTest.java?view=auto&rev=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/FloatControlTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/FloatControlTest.java
Mon Dec  4 22:29:36 2006
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.sampled;
+
+import javax.sound.sampled.FloatControl;
+
+import junit.framework.TestCase;
+
+public class FloatControlTest extends TestCase {
+
+    public void testFloatControl() {
+
+        FloatControl control = new MyControl(FloatControl.Type.MASTER_GAIN, 1f,
+                10f, 3f, 4, 5f, "units", "minLabel", "midLabel", "maxLabel");
+
+        assertEquals(FloatControl.Type.MASTER_GAIN, control.getType());
+        assertEquals(1f, control.getMinimum());
+        assertEquals(10f, control.getMaximum());
+        assertEquals("units", control.getUnits());
+        assertEquals("minLabel", control.getMinLabel());
+        assertEquals("midLabel", control.getMidLabel());
+        assertEquals("maxLabel", control.getMaxLabel());
+        assertEquals(3f, control.getPrecision());
+        assertEquals(4, control.getUpdatePeriod());
+
+        assertEquals(5f, control.getValue());
+        control.setValue(9f);
+        assertEquals(9f, control.getValue());
+        control.shift(9f, 4f, 5);
+        assertEquals(4f, control.getValue());
+        assertEquals(
+                "Master Gain with current value: 4.0 units (range: 1.0 - 10.0)",
+                control.toString());
+
+        try {
+            control.setValue(15f);
+            fail("No expected IllegalArgumentException");
+        } catch (IllegalArgumentException expected) {
+        }
+
+        control = new MyControl(FloatControl.Type.SAMPLE_RATE, 1f, 10f, 3f, 4,
+                5f, "units");
+        assertEquals(FloatControl.Type.SAMPLE_RATE, control.getType());
+        assertEquals(1f, control.getMinimum());
+        assertEquals(10f, control.getMaximum());
+        assertEquals("units", control.getUnits());
+        assertEquals("", control.getMinLabel());
+        assertEquals("", control.getMidLabel());
+        assertEquals("", control.getMaxLabel());
+        assertEquals(3f, control.getPrecision());
+        assertEquals(4, control.getUpdatePeriod());
+        assertEquals(5f, control.getValue());
+        assertEquals(
+                "Sample Rate with current value: 5.0 units (range: 1.0 - 10.0)",
+                control.toString());
+
+    }
+
+    private class MyControl extends FloatControl {
+        public MyControl(FloatControl.Type type, float minimum, float maximum,
+                float precision, int updatePeriod, float initialValue,
+                String units, String minLabel, String midLabel, String maxLabel) {
+            super(type, minimum, maximum, precision, updatePeriod,
+                    initialValue, units, minLabel, midLabel, maxLabel);
+        }
+
+        public MyControl(FloatControl.Type type, float minimum, float maximum,
+                float precision, int updatePeriod, float initialValue,
+                String units) {
+            super(type, minimum, maximum, precision, updatePeriod,
+                    initialValue, units);
+        }
+    }
+
+}
\ No newline at end of file

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

Added: harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/LineEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/LineEventTest.java?view=auto&rev=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/LineEventTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/LineEventTest.java
Mon Dec  4 22:29:36 2006
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.sampled;
+
+import javax.sound.sampled.Control;
+import javax.sound.sampled.Line;
+import javax.sound.sampled.LineEvent;
+import javax.sound.sampled.LineListener;
+import javax.sound.sampled.LineUnavailableException;
+
+import junit.framework.TestCase;
+
+public class LineEventTest extends TestCase {
+
+    public void testLineEvent() {
+
+        Line line = new MyLine();
+        LineEvent le = new LineEvent(line, LineEvent.Type.CLOSE, 1l);
+        assertEquals(line, le.getSource());
+        assertEquals(1, le.getFramePosition());
+        assertEquals(line, le.getLine());
+        assertEquals(LineEvent.Type.CLOSE, le.getType());
+        assertEquals("Close event from line MyLine", le.toString());
+
+    }
+
+    private class MyLine implements Line {
+
+        public MyLine() {
+        }
+
+        public void addLineListener(LineListener listener) {
+        }
+
+        public void close() {
+        }
+
+        public Control getControl(Control.Type control) {
+            return null;
+        }
+
+        public Control[] getControls() {
+            return null;
+        }
+
+        public Line.Info getLineInfo() {
+            return null;
+        }
+
+        public boolean isControlSupported(Control.Type control) {
+            return false;
+        }
+
+        public boolean isOpen() {
+            return false;
+        }
+
+        public void open() throws LineUnavailableException {
+        }
+
+        public void removeLineListener(LineListener listener) {
+        }
+
+        public String toString() {
+            return "MyLine";
+        }
+    }
+}
\ No newline at end of file

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

Added: harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/MixerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/MixerTest.java?view=auto&rev=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/MixerTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/MixerTest.java
Mon Dec  4 22:29:36 2006
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.sampled;
+
+import javax.sound.sampled.Mixer;
+
+import junit.framework.TestCase;
+
+public class MixerTest extends TestCase {
+
+    public void testMixer() {
+
+        Mixer.Info info = new MyMixerInfo("NAME", "VENDOR", "DESCRIPTION",
+                "VERSION");
+        assertEquals("DESCRIPTION", info.getDescription());
+        assertEquals("NAME", info.getName());
+        assertEquals("VENDOR", info.getVendor());
+        assertEquals("VERSION", info.getVersion());
+        assertEquals("NAME, version VERSION", info.toString());
+    }
+    
+    public void testEquals() {
+        Mixer.Info mi1 = new MyMixerInfo("1", "2", "3", "4");
+        Mixer.Info mi2 = new MyMixerInfo("1", "2", "3", "4");
+        assertFalse(mi1.equals(mi2));
+        assertTrue(mi1.equals(mi1));
+    }
+
+    private class MyMixerInfo extends Mixer.Info {
+        public MyMixerInfo(String name, String vendor, String description,
+                String version) {
+            super(name, vendor, description, version);
+        }
+    }
+}
\ No newline at end of file

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

Added: harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/PortInfoTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/PortInfoTest.java?view=auto&rev=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/PortInfoTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/PortInfoTest.java
Mon Dec  4 22:29:36 2006
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.sampled;
+
+import javax.sound.sampled.Port;
+
+import junit.framework.TestCase;
+
+public class PortInfoTest extends TestCase {
+
+    public void testPortInfo() {
+        assertEquals("COMPACT_DISC source port", Port.Info.COMPACT_DISC.toString());
+        assertEquals("LINE_OUT target port", Port.Info.LINE_OUT.toString());
+
+        Class cl = Port.class;
+        String name = "name";
+        Port.Info pi1 = new Port.Info(cl, name, true);
+        assertEquals(name, pi1.getName());
+        assertTrue(pi1.isSource());
+        
+        Port.Info pi2 = new Port.Info(cl, name, true);
+        assertFalse(pi1.equals(pi2));
+        assertTrue(pi1.equals(pi1));        
+        assertTrue(pi1.matches(pi2));
+        assertTrue(pi2.matches(pi1));
+
+        pi2 = new Port.Info(cl, "name1", false);
+        assertTrue(pi1.matches(pi1));
+        assertFalse(pi1.matches(pi2));
+        assertFalse(pi2.matches(pi1));
+    }
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/ReverbTypeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/ReverbTypeTest.java?view=auto&rev=482518
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/ReverbTypeTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sound/src/test/java/org/apache/harmony/sound/tests/javax/sound/sampled/ReverbTypeTest.java
Mon Dec  4 22:29:36 2006
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.sampled;
+
+import javax.sound.sampled.ReverbType;
+
+import junit.framework.TestCase;
+
+public class ReverbTypeTest extends TestCase {
+
+    public void testReverbType() {
+        ReverbType rt1 = new MyReverbType("name", 1, 2f, 3, 4f, 5);
+
+        assertEquals(
+                "name, early reflection delay 1 ns, early reflection intensity 2.0 dB, late
deflection delay 3 ns, late reflection intensity 4.0 dB, decay time 5",
+                rt1.toString());
+        assertEquals("name", rt1.getName());
+        assertEquals(1, rt1.getEarlyReflectionDelay());
+        assertEquals(2f, rt1.getEarlyReflectionIntensity());
+        assertEquals(3, rt1.getLateReflectionDelay());
+        assertEquals(4f, rt1.getLateReflectionIntensity());
+        assertEquals(5, rt1.getDecayTime());
+
+        ReverbType rt2 = new MyReverbType("name", 1, 2f, 3, 4f, 5);
+        assertFalse(rt1.equals(rt2));
+        assertTrue(rt1.equals(rt1));
+    }
+
+    private class MyReverbType extends ReverbType {
+        public MyReverbType(String name, int earlyReflectionDelay,
+                float earlyReflectionIntensity, int lateReflectionDelay,
+                float lateReflectionIntensity, int decayTime) {
+
+            super(name, earlyReflectionDelay, earlyReflectionIntensity,
+                    lateReflectionDelay, lateReflectionIntensity, decayTime);
+        }
+    }
+}

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



Mime
View raw message