@@ -113,41 +113,46 @@ my $bar_color = $imager->getpixel( x => 300, y => 200 );
113113 return defined $p ? sprintf ( ' %d/%d/%d' , ( $p -> rgba )[ 0, 1, 2 ] ) : ' oob' ;
114114 };
115115
116- diag sprintf ( ' Image: %dx%d channels=%d bits=%d type=%s' ,
116+ # RT::Test reconfigures Test::Builder's output handles, so Test::More's
117+ # diag() is swallowed by the harness. Write straight to STDERR with warn
118+ # instead (trailing "\n" suppresses the "at FILE line N" suffix).
119+ my $w = sub { warn @_ , " \n " };
120+
121+ $w -> ( sprintf ( ' Image: %dx%d channels=%d bits=%d type=%s' ,
117122 $imager -> getwidth, $imager -> getheight, $imager -> getchannels,
118- $imager -> bits, $imager -> type );
123+ $imager -> bits, $imager -> type ) ) ;
119124
120- diag ' PNG tags:' ;
125+ $w -> ( ' PNG tags:' ) ;
121126 for my $t ( $imager -> tags ) {
122- diag sprintf ( ' %s = %s' ,
123- $t -> [0], defined $t -> [1] ? $t -> [1] : ' (undef)' );
127+ $w -> ( sprintf ( ' %s = %s' ,
128+ $t -> [0], defined $t -> [1] ? $t -> [1] : ' (undef)' ) ) ;
124129 }
125130
126- diag sprintf ( ' Sampled pixel (300,200): %s '
131+ $w -> ( sprintf ( ' Sampled pixel (300,200): %s '
127132 . ' (expected ~166/206/227; ranges red 150-180, green 190-220, blue 210-240)' ,
128- $px -> ( 300, 200 ) );
133+ $px -> ( 300, 200 ) ) ) ;
129134
130135 # Neighborhood around the sample point.
131136 for my $y ( 180, 190, 200, 210, 220 ) {
132- diag join ' ' , " neighborhood y=$y :" ,
133- map { " x=$_ :" . $px -> ( $_ , $y ) } ( 260, 280, 300, 320, 340 );
137+ $w -> ( join ' ' , " neighborhood y=$y :" ,
138+ map { " x=$_ :" . $px -> ( $_ , $y ) } ( 260, 280, 300, 320, 340 ) ) ;
134139 }
135140
136141 # Horizontal scan across the middle row to locate the bars.
137142 for ( my $x = 0 ; $x < $imager -> getwidth ; $x += 25 ) {
138- diag sprintf ( ' hscan y=200 x=%d: %s' , $x , $px -> ( $x , 200 ) );
143+ $w -> ( sprintf ( ' hscan y=200 x=%d: %s' , $x , $px -> ( $x , 200 ) ) );
139144 }
140145
141146 # Vertical scan down x=300 to see the bar's height/position.
142147 for ( my $y = 0 ; $y < $imager -> getheight ; $y += 25 ) {
143- diag sprintf ( ' vscan x=300 y=%d: %s' , $y , $px -> ( 300, $y ) );
148+ $w -> ( sprintf ( ' vscan x=300 y=%d: %s' , $y , $px -> ( 300, $y ) ) );
144149 }
145150
146151 # Raw PNG as a single base64 line between sentinels. To recover the image:
147152 # grep -o 'PNGB64 [A-Za-z0-9+/=]*' log | awk '{print $2}' | base64 -d > chart.png
148153 require MIME::Base64;
149- diag ' PNGB64 '
150- . MIME::Base64::encode_base64( $mail_image -> bodyhandle-> as_string, ' ' );
154+ $w -> ( ' PNGB64 '
155+ . MIME::Base64::encode_base64( $mail_image -> bodyhandle-> as_string, ' ' ) ) ;
151156}
152157# -----------------------------------------------------------------------------
153158
0 commit comments