Skip to content

Commit 4c61bf0

Browse files
committed
Regression test for setting some min/max decibels for AnalyserNode
1 parent 9e9147a commit 4c61bf0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/node/analyser.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ impl AudioProcessor for AnalyserRenderer {
289289

290290
#[cfg(test)]
291291
mod tests {
292-
use crate::context::{AudioContext, AudioContextOptions, BaseAudioContext};
292+
use super::*;
293+
use crate::context::{
294+
AudioContext, AudioContextOptions, BaseAudioContext, OfflineAudioContext,
295+
};
293296
use crate::node::{AudioNode, AudioScheduledSourceNode};
294297
use float_eq::assert_float_eq;
295298

@@ -324,4 +327,15 @@ mod tests {
324327
// should contain the most recent frames available
325328
assert_float_eq!(&buffer[..], &[1.; 128][..], abs_all <= 0.);
326329
}
330+
331+
#[test]
332+
fn test_construct_decibels() {
333+
let context = OfflineAudioContext::new(1, 128, 44_100.);
334+
let options = AnalyserOptions {
335+
min_decibels: -10.,
336+
max_decibels: 20.,
337+
..AnalyserOptions::default()
338+
};
339+
let _ = AnalyserNode::new(&context, options);
340+
}
327341
}

0 commit comments

Comments
 (0)