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 {
531
531
let node1 = context. create_constant_source ( ) ;
532
532
let node2 = context. create_gain ( ) ;
533
533
534
+ // connection list starts empty
535
+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
536
+
534
537
node1. disconnect ( ) ; // never panic for plain disconnect calls
535
538
536
539
node1. connect ( & node2) ;
540
+
541
+ // connection should be registered
542
+ assert_eq ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . len( ) , 1 ) ;
543
+
537
544
node1. disconnect ( ) ;
545
+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
538
546
539
547
node1. connect ( & node2) ;
548
+ assert_eq ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . len( ) , 1 ) ;
549
+
540
550
node1. disconnect_dest ( & node2) ;
551
+ assert ! ( context. base( ) . inner. connections. lock( ) . unwrap( ) . is_empty( ) ) ;
541
552
}
542
553
543
554
#[ test]
@@ -549,4 +560,18 @@ mod tests {
549
560
550
561
node1. disconnect_dest ( & node2) ;
551
562
}
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
+ }
552
577
}
You can’t perform that action at this time.
0 commit comments