File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -983,6 +983,35 @@ mod tests {
983983        assert_eq ! ( & buf[ 0 ] ,  "fghijklmno" ) ; 
984984    } 
985985
986+     #[ test]  
987+     fn  multicolor_without_current_style ( )  { 
988+         set_colors_enabled ( true ) ; 
989+ 
990+         const  CHARS :  & str  = "=-" ; 
991+         const  WIDTH :  u16  = 8 ; 
992+         let  pos = Arc :: new ( AtomicPosition :: new ( ) ) ; 
993+         // half finished 
994+         pos. set ( 2 ) ; 
995+         let  state = ProgressState :: new ( Some ( 4 ) ,  pos) ; 
996+         let  mut  buf = Vec :: new ( ) ; 
997+ 
998+         let  style = ProgressStyle :: with_template ( "{wide_bar}" ) 
999+             . unwrap ( ) 
1000+             . progress_chars ( CHARS ) ; 
1001+         style. format_state ( & state,  & mut  buf,  WIDTH ) ; 
1002+         assert_eq ! ( & buf[ 0 ] ,  "====----" ) ; 
1003+ 
1004+         buf. clear ( ) ; 
1005+         let  style = ProgressStyle :: with_template ( "{wide_bar:.red.on_blue/green.on_cyan}" ) 
1006+             . unwrap ( ) 
1007+             . progress_chars ( CHARS ) ; 
1008+         style. format_state ( & state,  & mut  buf,  WIDTH ) ; 
1009+         assert_eq ! ( 
1010+             & buf[ 0 ] , 
1011+             "\u{1b} [31m\u{1b} [44m====\u{1b} [32m\u{1b} [46m----\u{1b} [0m\u{1b} [0m" 
1012+         ) ; 
1013+     } 
1014+ 
9861015    #[ test]  
9871016    fn  wide_element_style ( )  { 
9881017        set_colors_enabled ( true ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments