@@ -117,20 +117,31 @@ impl<K, V, O: ErrorBarOrient<K, V>, DB: DrawingBackend> Drawable<DB> for ErrorBa
117117 let points: Vec < _ > = points. take ( 3 ) . collect ( ) ;
118118
119119 let ( from, to) = O :: ending_coord ( points[ 0 ] , self . width ) ;
120- backend. draw_line ( from, to, & self . style . color ) ?;
120+ backend. draw_line ( from, to, & self . style ) ?;
121121
122122 let ( from, to) = O :: ending_coord ( points[ 2 ] , self . width ) ;
123- backend. draw_line ( from, to, & self . style . color ) ?;
123+ backend. draw_line ( from, to, & self . style ) ?;
124124
125- backend. draw_line ( points[ 0 ] , points[ 2 ] , & self . style . color ) ?;
125+ backend. draw_line ( points[ 0 ] , points[ 2 ] , & self . style ) ?;
126126
127- backend. draw_circle (
128- points[ 1 ] ,
129- self . width / 2 ,
130- & self . style . color ,
131- self . style . filled ,
132- ) ?;
127+ backend. draw_circle ( points[ 1 ] , self . width / 2 , & self . style , self . style . filled ) ?;
133128
134129 Ok ( ( ) )
135130 }
136131}
132+
133+ #[ cfg( test) ]
134+ #[ test]
135+ fn test_preserve_stroke_width ( ) {
136+ let v = ErrorBar :: new_vertical ( 100 , 20 , 50 , 70 , WHITE . filled ( ) . stroke_width ( 5 ) , 3 ) ;
137+ let h = ErrorBar :: new_horizontal ( 100 , 20 , 50 , 70 , WHITE . filled ( ) . stroke_width ( 5 ) , 3 ) ;
138+
139+ use crate :: prelude:: * ;
140+ let da = crate :: create_mocked_drawing_area ( 300 , 300 , |m| {
141+ m. check_draw_line ( |_, w, _, _| {
142+ assert_eq ! ( w, 5 ) ;
143+ } ) ;
144+ } ) ;
145+ da. draw ( & h) . expect ( "Drawing Failure" ) ;
146+ da. draw ( & v) . expect ( "Drawing Failure" ) ;
147+ }
0 commit comments