#!/usr/bin/perl
BEGIN { plan
tests
=> 6 };
ok(1);
my
$bar
= new PostScript::Graph::Bar(
file
=> {
landscape
=> 1,
debug
=> 2,
errors
=> 1,
},
layout
=> {
heavy_color
=> [0, 0, 0.7],
mid_color
=> [0, 0.5, 1],
},
style
=> {
auto
=> [
qw(red green blue)
],
},
);
ok(
$bar
);
$bar
->build_chart(
"t/multi.csv"
);
ok(1);
my
$name
=
"t/34ba-multi"
;
$bar
->output(
$name
);
ok(1);
my
$psfile
= check_file(
"$name.ps"
);
ok(
$psfile
);
ok( check_filesize(
$psfile
, -s
$psfile
) );
warn
"Use ghostview or similar to inspect results file:\n$psfile\n"
;
sub
check_filesize {
my
(
$psfile
,
$pssize
) =
@_
;
my
%fs
;
my
$filesizes
=
't/filesizes'
;
if
(
open
(IN,
'<'
,
$filesizes
)) {
while
(<IN>) {
chomp
;
my
(
$size
,
$file
) = m/^(\d+)\t(.+)$/;
$fs
{
$file
} =
$size
;
}
close
IN;
}
my
$exists
=
$fs
{
$psfile
};
my
$res
= (
$fs
{
$psfile
} ==
$pssize
);
$fs
{
$psfile
} =
$pssize
;
open
(OUT,
'>'
,
$filesizes
) or
die
"Unable to write to $filesizes : $!\n"
;
while
(
my
(
$file
,
$size
) =
each
%fs
) {
print
OUT
"$size\t$file\n"
if
defined
$file
and
defined
$size
;
}
close
OUT;
return
1
unless
$exists
;
return
$res
;
}