File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
tests/IntegrationTests/AudioNodeTests Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -309,4 +309,59 @@ public async Task SetMinDecibelsAsync_ThrowsIndexSizeErrorException_WhenSetHighe
309309 // Assert
310310 _ = await action . Should ( ) . ThrowAsync < IndexSizeErrorException > ( ) ;
311311 }
312+
313+ [ Test ]
314+ [ TestCase ( 0.8 ) ]
315+ [ TestCase ( 0 ) ]
316+ public async Task GetSmoothingTimeConstantAsync_ShouldRetrieveSmoothingTimeConstant ( double smoothingTimeConstant )
317+ {
318+ // Arrange
319+ await using AudioContext context = await GetAudioContextAsync ( ) ;
320+
321+ await using AnalyserNode node = await AnalyserNode . CreateAsync ( JSRuntime , context , new ( )
322+ {
323+ SmoothingTimeConstant = smoothingTimeConstant
324+ } ) ;
325+
326+ // Act
327+ double readSmoothingTimeConstant = await node . GetSmoothingTimeConstantAsync ( ) ;
328+
329+ // Assert
330+ _ = readSmoothingTimeConstant . Should ( ) . Be ( smoothingTimeConstant ) ;
331+ }
332+
333+ [ Test ]
334+ [ TestCase ( 0.8 ) ]
335+ [ TestCase ( 0 ) ]
336+ public async Task SetSmoothingTimeConstantAsync_ShouldUpdateSmoothingTimeConstant ( double smoothingTimeConstant )
337+ {
338+ // Arrange
339+ await using AudioContext context = await GetAudioContextAsync ( ) ;
340+
341+ await using AnalyserNode node = await AnalyserNode . CreateAsync ( JSRuntime , context ) ;
342+
343+ // Act
344+ await node . SetSmoothingTimeConstantAsync ( smoothingTimeConstant ) ;
345+
346+ // Assert
347+ double readSmoothingTimeConstant = await node . GetSmoothingTimeConstantAsync ( ) ;
348+ _ = readSmoothingTimeConstant . Should ( ) . Be ( smoothingTimeConstant ) ;
349+ }
350+
351+ [ Test ]
352+ [ TestCase ( - 0.2 ) ]
353+ [ TestCase ( 1.2 ) ]
354+ public async Task SetMinDecibelsAsync_ThrowsIndexSizeErrorException_WhenSetToValueOutsideRange ( double smoothingTimeConstant )
355+ {
356+ // Arrange
357+ await using AudioContext context = await GetAudioContextAsync ( ) ;
358+
359+ await using AnalyserNode node = await AnalyserNode . CreateAsync ( JSRuntime , context ) ;
360+
361+ // Act
362+ Func < Task > action = async ( ) => await node . SetSmoothingTimeConstantAsync ( smoothingTimeConstant ) ;
363+
364+ // Assert
365+ _ = await action . Should ( ) . ThrowAsync < IndexSizeErrorException > ( ) ;
366+ }
312367}
You can’t perform that action at this time.
0 commit comments