Skip to content

Commit 88d9779

Browse files
authored
AudioFilterTest: added HighPassFilter and BandPassFilter tests
1 parent 389d91a commit 88d9779

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

jme3-core/src/test/java/com/jme3/audio/AudioFilterTest.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class AudioFilterTest {
1717
* Tests serialization and de-serialization of a {@code LowPassFilter}.
1818
*/
1919
@Test
20-
public void testSaveAndLoad() {
20+
public void testSaveAndLoad_LowPassFilter() {
2121
AssetManager assetManager = new DesktopAssetManager(true);
2222

2323
LowPassFilter f = new LowPassFilter(.5f, .5f);
@@ -28,4 +28,35 @@ public void testSaveAndLoad() {
2828
Assert.assertEquals(f.getHighFreqVolume(), copy.getHighFreqVolume(), delta);
2929
}
3030

31+
/**
32+
* Tests serialization and de-serialization of a {@code HighPassFilter}.
33+
*/
34+
@Test
35+
public void testSaveAndLoad_HighPassFilter() {
36+
AssetManager assetManager = new DesktopAssetManager(true);
37+
38+
HighPassFilter f = new HighPassFilter(.5f, .5f);
39+
HighPassFilter copy = BinaryExporter.saveAndLoad(assetManager, f);
40+
41+
float delta = 0.001f;
42+
Assert.assertEquals(f.getVolume(), copy.getVolume(), delta);
43+
Assert.assertEquals(f.getLowFreqVolume(), copy.getLowFreqVolume(), delta);
44+
}
45+
46+
/**
47+
* Tests serialization and de-serialization of a {@code BandPassFilter}.
48+
*/
49+
@Test
50+
public void testSaveAndLoad_BandPassFilter() {
51+
AssetManager assetManager = new DesktopAssetManager(true);
52+
53+
BandPassFilter f = new BandPassFilter(.5f, .5f, .5f);
54+
BandPassFilter copy = BinaryExporter.saveAndLoad(assetManager, f);
55+
56+
float delta = 0.001f;
57+
Assert.assertEquals(f.getVolume(), copy.getVolume(), delta);
58+
Assert.assertEquals(f.getHighFreqVolume(), copy.getHighFreqVolume(), delta);
59+
Assert.assertEquals(f.getLowFreqVolume(), copy.getLowFreqVolume(), delta);
60+
}
61+
3162
}

0 commit comments

Comments
 (0)