Skip to content
Prev Previous commit
Next Next commit
AudioFilterTest: added HighPassFilter and BandPassFilter tests
  • Loading branch information
capdevon authored May 20, 2025
commit ae01c94f82b540c98f30ac2f457bff130eb90ab7
33 changes: 32 additions & 1 deletion jme3-core/src/test/java/com/jme3/audio/AudioFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AudioFilterTest {
* Tests serialization and de-serialization of a {@code LowPassFilter}.
*/
@Test
public void testSaveAndLoad() {
public void testSaveAndLoad_LowPassFilter() {
AssetManager assetManager = new DesktopAssetManager(true);

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

/**
* Tests serialization and de-serialization of a {@code HighPassFilter}.
*/
@Test
public void testSaveAndLoad_HighPassFilter() {
AssetManager assetManager = new DesktopAssetManager(true);

HighPassFilter f = new HighPassFilter(.5f, .5f);
HighPassFilter copy = BinaryExporter.saveAndLoad(assetManager, f);

float delta = 0.001f;
Assert.assertEquals(f.getVolume(), copy.getVolume(), delta);
Assert.assertEquals(f.getLowFreqVolume(), copy.getLowFreqVolume(), delta);
}

/**
* Tests serialization and de-serialization of a {@code BandPassFilter}.
*/
@Test
public void testSaveAndLoad_BandPassFilter() {
AssetManager assetManager = new DesktopAssetManager(true);

BandPassFilter f = new BandPassFilter(.5f, .5f, .5f);
BandPassFilter copy = BinaryExporter.saveAndLoad(assetManager, f);

float delta = 0.001f;
Assert.assertEquals(f.getVolume(), copy.getVolume(), delta);
Assert.assertEquals(f.getHighFreqVolume(), copy.getHighFreqVolume(), delta);
Assert.assertEquals(f.getLowFreqVolume(), copy.getLowFreqVolume(), delta);
}

}