File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -531,13 +531,24 @@ mod tests {
531531 let node1 = context. create_constant_source ( ) ;
532532 let node2 = context. create_gain ( ) ;
533533
534+ // connection list starts empty
535+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
536+
534537 node1. disconnect ( ) ; // never panic for plain disconnect calls
535538
536539 node1. connect ( & node2) ;
540+
541+ // connection should be registered
542+ assert_eq ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . len( ) , 1 ) ;
543+
537544 node1. disconnect ( ) ;
545+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
538546
539547 node1. connect ( & node2) ;
548+ assert_eq ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . len( ) , 1 ) ;
549+
540550 node1. disconnect_dest ( & node2) ;
551+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
541552 }
542553
543554 #[ test]
@@ -549,4 +560,18 @@ mod tests {
549560
550561 node1. disconnect_dest ( & node2) ;
551562 }
563+
564+ #[ test]
565+ fn test_mark_node_dropped ( ) {
566+ let context = OfflineAudioContext :: new ( 1 , 128 , 48000. ) ;
567+
568+ let node1 = context. create_constant_source ( ) ;
569+ let node2 = context. create_gain ( ) ;
570+
571+ node1. connect ( & node2) ;
572+ context. base ( ) . mark_node_dropped ( node1. registration ( ) . id ( ) ) ;
573+
574+ // dropping should clear connections administration
575+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
576+ }
552577}
You can’t perform that action at this time.
0 commit comments