File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
tests/IntegrationTests/AudioNodeTests Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,47 @@ public async Task SetBufferAsync_WithNullArgument_ShouldClearBuffer()
9393 _ = readBuffer . Should ( ) . BeNull ( ) ;
9494 }
9595
96+ [ Test ]
97+ [ TestCase ( 3ul ) ]
98+ [ TestCase ( 5ul ) ]
99+ public async Task SetBufferAsync_WithBufferThatHasUnsupportedNumberOfChannels_ThrowsNotSupportErrorException ( ulong numberOfChannels )
100+ {
101+ // Arrange
102+ await using ConvolverNode node = await ConvolverNode . CreateAsync ( JSRuntime , AudioContext ) ;
103+
104+ await using AudioBuffer buffer = await AudioBuffer . CreateAsync ( JSRuntime , new AudioBufferOptions ( )
105+ {
106+ Length = 1 ,
107+ SampleRate = await AudioContext . GetSampleRateAsync ( ) ,
108+ NumberOfChannels = numberOfChannels
109+ } ) ;
110+
111+ // Act
112+ Func < Task > action = async ( ) => await node . SetBufferAsync ( buffer ) ;
113+
114+ // Assert
115+ _ = await action . Should ( ) . ThrowAsync < NotSupportedErrorException > ( ) ;
116+ }
117+
118+ [ Test ]
119+ public async Task SetBufferAsync_WithBufferThatHasMismatchingSampleRate_ThrowsNotSupportErrorException ( )
120+ {
121+ // Arrange
122+ await using ConvolverNode node = await ConvolverNode . CreateAsync ( JSRuntime , AudioContext ) ;
123+
124+ await using AudioBuffer buffer = await AudioBuffer . CreateAsync ( JSRuntime , new AudioBufferOptions ( )
125+ {
126+ Length = 1 ,
127+ SampleRate = await AudioContext . GetSampleRateAsync ( ) + 100
128+ } ) ;
129+
130+ // Act
131+ Func < Task > action = async ( ) => await node . SetBufferAsync ( buffer ) ;
132+
133+ // Assert
134+ _ = await action . Should ( ) . ThrowAsync < NotSupportedErrorException > ( ) ;
135+ }
136+
96137 [ Test ]
97138 [ TestCase ( false ) ]
98139 [ TestCase ( true ) ]
You can’t perform that action at this time.
0 commit comments