File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,19 @@ mod test {
422
422
. build( ) ,
423
423
super :: Signal :: builder( "create-string" )
424
424
. return_type:: <String >( )
425
+ . accumulator( |_hint, acc, val| {
426
+ // join all strings from signal handlers by newline
427
+ let mut acc = acc
428
+ . get_owned:: <Option <String >>( )
429
+ . unwrap( )
430
+ . map( |mut acc| {
431
+ acc. push( '\n' ) ;
432
+ acc
433
+ } )
434
+ . unwrap_or_default( ) ;
435
+ acc. push_str( val. get:: <& str >( ) . unwrap( ) ) ;
436
+ std:: ops:: ControlFlow :: Continue ( acc. to_value( ) )
437
+ } )
425
438
. build( ) ,
426
439
super :: Signal :: builder( "create-child-object" )
427
440
. return_type:: <super :: ChildObject >( )
@@ -891,13 +904,17 @@ mod test {
891
904
let obj = Object :: with_type ( SimpleObject :: static_type ( ) ) ;
892
905
893
906
obj. connect ( "create-string" , false , move |_args| {
894
- Some ( "return value" . to_value ( ) )
907
+ Some ( "return value 1" . to_value ( ) )
908
+ } ) ;
909
+
910
+ obj. connect ( "create-string" , false , move |_args| {
911
+ Some ( "return value 2" . to_value ( ) )
895
912
} ) ;
896
913
897
914
let signal_id = imp:: SimpleObject :: signals ( ) [ 2 ] . signal_id ( ) ;
898
915
899
916
let value = obj. emit :: < String > ( signal_id, & [ ] ) ;
900
- assert_eq ! ( value, "return value" ) ;
917
+ assert_eq ! ( value, "return value 1 \n return value 2 " ) ;
901
918
}
902
919
903
920
#[ test]
You can’t perform that action at this time.
0 commit comments