@@ -146,8 +146,6 @@ mod tests {
146146 use super :: * ;
147147 use crate :: node:: AudioNode ;
148148
149- use float_eq:: assert_float_eq;
150-
151149 fn require_send_sync_static < T : Send + Sync + ' static > ( _: T ) { }
152150
153151 #[ test]
@@ -156,7 +154,7 @@ mod tests {
156154 let registration = context. mock_registration ( ) ;
157155
158156 // we want to be able to ship AudioNodes to another thread, so the Registration should be
159- // Send Sync and 'static
157+ // Send, Sync and 'static
160158 require_send_sync_static ( registration) ;
161159 }
162160
@@ -167,62 +165,17 @@ mod tests {
167165 }
168166
169167 #[ test]
170- fn test_sample_rate_length ( ) {
171- let context = OfflineAudioContext :: new ( 1 , 48000 , 96000. ) ;
172- assert_float_eq ! ( context. sample_rate( ) , 96000. , abs_all <= 0. ) ;
173- assert_eq ! ( context. length( ) , 48000 ) ;
174- }
175-
176- #[ test]
177- fn test_decode_audio_data ( ) {
178- let context = OfflineAudioContext :: new ( 1 , 1 , 44100. ) ;
179- let file = std:: fs:: File :: open ( "samples/sample.wav" ) . unwrap ( ) ;
180- let audio_buffer = context. decode_audio_data_sync ( file) . unwrap ( ) ;
181-
182- assert_eq ! ( audio_buffer. sample_rate( ) , 44100. ) ;
183- assert_eq ! ( audio_buffer. length( ) , 142_187 ) ;
184- assert_eq ! ( audio_buffer. number_of_channels( ) , 2 ) ;
185- assert_float_eq ! ( audio_buffer. duration( ) , 3.224 , abs_all <= 0.001 ) ;
186-
187- let left_start = & audio_buffer. get_channel_data ( 0 ) [ 0 ..100 ] ;
188- let right_start = & audio_buffer. get_channel_data ( 1 ) [ 0 ..100 ] ;
189- // assert distinct two channel data
190- assert ! ( left_start != right_start) ;
191- }
192-
193- // #[test]
194- // disabled: symphonia cannot handle empty WAV-files
195- #[ allow( dead_code) ]
196- fn test_decode_audio_data_empty ( ) {
197- let context = OfflineAudioContext :: new ( 1 , 1 , 44100. ) ;
198- let file = std:: fs:: File :: open ( "samples/empty_2c.wav" ) . unwrap ( ) ;
199- let audio_buffer = context. decode_audio_data_sync ( file) . unwrap ( ) ;
200- assert_eq ! ( audio_buffer. length( ) , 0 ) ;
201- }
202-
203- #[ test]
204- fn test_decode_audio_data_decoding_error ( ) {
205- let context = OfflineAudioContext :: new ( 1 , 1 , 44100. ) ;
206- let file = std:: fs:: File :: open ( "samples/corrupt.wav" ) . unwrap ( ) ;
207- assert ! ( context. decode_audio_data_sync( file) . is_err( ) ) ;
208- }
209-
210- #[ test]
211- fn test_create_buffer ( ) {
212- let number_of_channels = 3 ;
213- let length = 2000 ;
214- let sample_rate = 96_000. ;
215-
216- let context = OfflineAudioContext :: new ( 1 , 1 , 44100. ) ;
217- let buffer = context. create_buffer ( number_of_channels, length, sample_rate) ;
218-
219- assert_eq ! ( buffer. number_of_channels( ) , 3 ) ;
220- assert_eq ! ( buffer. length( ) , 2000 ) ;
221- assert_float_eq ! ( buffer. sample_rate( ) , 96000. , abs_all <= 0. ) ;
168+ fn test_online_audio_context_send_sync ( ) {
169+ let options = AudioContextOptions {
170+ sink_id : "none" . into ( ) ,
171+ ..AudioContextOptions :: default ( )
172+ } ;
173+ let context = AudioContext :: new ( options) ;
174+ require_send_sync_static ( context) ;
222175 }
223176
224177 #[ test]
225- fn test_registration ( ) {
178+ fn test_context_equals ( ) {
226179 let context = OfflineAudioContext :: new ( 1 , 48000 , 96000. ) ;
227180 let dest = context. destination ( ) ;
228181 assert ! ( dest. context( ) == context. base( ) ) ;
0 commit comments