changeset in /hg/pulseaudio: 2008-08-12 Omair Majid <omajid at redh...

Omair Majid omajid at redhat.com
Tue Aug 12 07:51:15 PDT 2008


changeset 573735d22e54 in /hg/pulseaudio
details: http://icedtea.classpath.org/hg/pulseaudio?cmd=changeset;node=573735d22e54
description:
	2008-08-12 Omair Majid <omajid at redhat.com>

	    * src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java: getControls() now returns a null rather than a Control[2] containing nulls
	    * unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java: fixed the testFindControl() test to check the array returned

diffstat:

2 files changed, 19 insertions(+), 9 deletions(-)
src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |    3 -
unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java |   25 ++++++----

diffs (68 lines):

diff -r 748e7984cd83 -r 573735d22e54 src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Tue Aug 12 10:31:11 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Tue Aug 12 10:51:02 2008 -0400
@@ -75,7 +75,7 @@ public class PulseAudioSourceDataLine im
 
 	private List<LineListener> listeners;
 
-	private Control[] controls = new Control[2];
+	private Control[] controls = null;
 	private PulseAudioStreamMuteControl muteControl;
 	private PulseAudioStreamVolumeControl volumeControl;
 	private boolean muted;
@@ -376,6 +376,7 @@ public class PulseAudioSourceDataLine im
 		}
 		System.out.println(this.getClass().getName() + "stream is ready");
 
+		controls = new Control[2];
 		volumeControl = new PulseAudioStreamVolumeControl(this);
 		controls[0] = volumeControl;
 		muteControl = new PulseAudioStreamMuteControl(this);
diff -r 748e7984cd83 -r 573735d22e54 unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java
--- a/unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java	Tue Aug 12 10:31:11 2008 -0400
+++ b/unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java	Tue Aug 12 10:51:02 2008 -0400
@@ -44,6 +44,7 @@ import javax.sound.sampled.AudioInputStr
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.Control;
 import javax.sound.sampled.DataLine;
 import javax.sound.sampled.FloatControl;
 import javax.sound.sampled.Line;
@@ -176,20 +177,28 @@ public class PulseSourceDataLineTest {
 	public void testFindControl() throws LineUnavailableException {
 		SourceDataLine sourceLine = (SourceDataLine) mixer
 				.getLine(new Line.Info(SourceDataLine.class));
+		sourceLine.open();
+		Control[] controls = sourceLine.getControls();
+		Assert.assertNotNull(controls);
 		Assert.assertTrue(sourceLine.getControls().length > 0);
-	}
-
-	
+		for (Control control : controls) {
+			Assert.assertNotNull(control);
+		}
+		sourceLine.close();
+	}
+
 	@Test
 	public void testSupportedControls() throws LineUnavailableException {
 		SourceDataLine sourceLine = (SourceDataLine) mixer
 				.getLine(new Line.Info(SourceDataLine.class));
 		sourceLine.open();
-		Assert.assertTrue(sourceLine.isControlSupported(FloatControl.Type.VOLUME));
-		Assert.assertTrue(sourceLine.isControlSupported(BooleanControl.Type.MUTE));
-	}
-
-	
+		Assert.assertTrue(sourceLine
+				.isControlSupported(FloatControl.Type.VOLUME));
+		Assert.assertTrue(sourceLine
+				.isControlSupported(BooleanControl.Type.MUTE));
+		sourceLine.close();
+	}
+
 	@After
 	public void tearDown() throws Exception {
 



More information about the distro-pkg-dev mailing list