@@ -488,38 +488,37 @@ mod tests {
488488 use super :: * ;
489489
490490 #[ test]
491- fn test_constructor ( ) {
492- {
493- let context = OfflineAudioContext :: new ( 1 , 0 , 44_100. ) ;
494- let compressor = DynamicsCompressorNode :: new ( & context, Default :: default ( ) ) ;
495-
496- assert_float_eq ! ( compressor. attack( ) . value( ) , 0.003 , abs <= 0. ) ;
497- assert_float_eq ! ( compressor. knee( ) . value( ) , 30. , abs <= 0. ) ;
498- assert_float_eq ! ( compressor. ratio( ) . value( ) , 12. , abs <= 0. ) ;
499- assert_float_eq ! ( compressor. release( ) . value( ) , 0.25 , abs <= 0. ) ;
500- assert_float_eq ! ( compressor. threshold( ) . value( ) , -24. , abs <= 0. ) ;
501- }
491+ fn test_constructor_default ( ) {
492+ let context = OfflineAudioContext :: new ( 1 , 1 , 44_100. ) ;
493+ let compressor = DynamicsCompressorNode :: new ( & context, Default :: default ( ) ) ;
502494
503- {
504- let context = OfflineAudioContext :: new ( 1 , 0 , 44_100. ) ;
505- let compressor = DynamicsCompressorNode :: new (
506- & context,
507- DynamicsCompressorOptions {
508- attack : 0.5 ,
509- knee : 12. ,
510- ratio : 1. ,
511- release : 0.75 ,
512- threshold : -60. ,
513- ..DynamicsCompressorOptions :: default ( )
514- } ,
515- ) ;
516-
517- assert_float_eq ! ( compressor. attack( ) . value( ) , 0.5 , abs <= 0. ) ;
518- assert_float_eq ! ( compressor. knee( ) . value( ) , 12. , abs <= 0. ) ;
519- assert_float_eq ! ( compressor. ratio( ) . value( ) , 1. , abs <= 0. ) ;
520- assert_float_eq ! ( compressor. release( ) . value( ) , 0.75 , abs <= 0. ) ;
521- assert_float_eq ! ( compressor. threshold( ) . value( ) , -60. , abs <= 0. ) ;
522- }
495+ assert_float_eq ! ( compressor. attack( ) . value( ) , 0.003 , abs <= 0. ) ;
496+ assert_float_eq ! ( compressor. knee( ) . value( ) , 30. , abs <= 0. ) ;
497+ assert_float_eq ! ( compressor. ratio( ) . value( ) , 12. , abs <= 0. ) ;
498+ assert_float_eq ! ( compressor. release( ) . value( ) , 0.25 , abs <= 0. ) ;
499+ assert_float_eq ! ( compressor. threshold( ) . value( ) , -24. , abs <= 0. ) ;
500+ }
501+
502+ #[ test]
503+ fn test_constructor_non_default ( ) {
504+ let context = OfflineAudioContext :: new ( 1 , 1 , 44_100. ) ;
505+ let compressor = DynamicsCompressorNode :: new (
506+ & context,
507+ DynamicsCompressorOptions {
508+ attack : 0.5 ,
509+ knee : 12. ,
510+ ratio : 1. ,
511+ release : 0.75 ,
512+ threshold : -60. ,
513+ ..DynamicsCompressorOptions :: default ( )
514+ } ,
515+ ) ;
516+
517+ assert_float_eq ! ( compressor. attack( ) . value( ) , 0.5 , abs <= 0. ) ;
518+ assert_float_eq ! ( compressor. knee( ) . value( ) , 12. , abs <= 0. ) ;
519+ assert_float_eq ! ( compressor. ratio( ) . value( ) , 1. , abs <= 0. ) ;
520+ assert_float_eq ! ( compressor. release( ) . value( ) , 0.75 , abs <= 0. ) ;
521+ assert_float_eq ! ( compressor. threshold( ) . value( ) , -60. , abs <= 0. ) ;
523522 }
524523
525524 #[ test]
0 commit comments