[Bps-public-commit] r11221 - WebChart/t

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Mar 26 22:19:26 EDT 2008


Author: sunnavy
Date: Wed Mar 26 22:19:26 2008
New Revision: 11221

Modified:
   WebChart/t/chart.t

Log:
updated chart.t since we wrapped file comparison in WebChart::Test

Modified: WebChart/t/chart.t
==============================================================================
--- WebChart/t/chart.t	(original)
+++ WebChart/t/chart.t	Wed Mar 26 22:19:26 2008
@@ -1,8 +1,9 @@
 use strict;
 use warnings;
 
+use lib 't/lib';
 use Test::More qw/no_plan/;
-
+use WebChart::Test qw/is_file/;
 use WebChart;
 
 # default renderer is Chart
@@ -24,18 +25,7 @@
     data => $data,
 );
 
-my ( $x, $y );                             # for file content compare
-
-{
-    local $/;
-    my $fh;
-    open $fh, '<', $file;
-    $x = <$fh>;
-    open $fh, '<', 't/data/chart_bars_400x300.png';
-    $y = <$fh>;
-}
-
-is( $x, $y, 'generated bars is right' );
+is_file( $file, 't/data/chart_bars_400x300.png', 'generated bars is right' );
 
 like( $seg, qr{<img src="/charts/.*png" />}, 'render bars works' );
 
@@ -46,16 +36,7 @@
     data   => $data,
 );
 
-{
-    local $/;
-    my $fh;
-    open $fh, '<', $file;
-    $x = <$fh>;
-    open $fh, '<', 't/data/chart_bars_800x600.png';
-    $y = <$fh>;
-}
-
-is( $x, $y, 'width and height args works' );
+is_file( $file, 't/data/chart_bars_800x600.png', 'width and height args works' );
 
 $seg = $wc->render(
     type        => 'bars',
@@ -82,16 +63,7 @@
     'render pie works'
 );
 
-{
-    local $/;
-    my $fh;
-    open $fh, '<', $file;
-    $x = <$fh>;
-    open $fh, '<', 't/data/chart_pie_400x300.png';
-    $y = <$fh>;
-}
-
-is( $x, $y, 'generated pie is right' );
+is_file( $file, 't/data/chart_pie_400x300.png', 'generated pie is right' );
 
 like( $seg, qr{<img src="/charts/.*png" />}, 'render pie works' );
 



More information about the Bps-public-commit mailing list