1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
use strict;
use warnings;
use Test::More tests => 3;
use SVG;
# test: style
subtest rectangle => sub {
plan tests => 1;
my $svg = SVG->new;
my $tag = $svg->rectangle(
x => 10,
y => 20,
width => 4,
height => 5,
rx => 5.2,
ry => 2.4,
id => 'rect_1',
);
my $xml = $svg->xmlify;
like $xml,
qr{<rect height="5" id="rect_1" rx="5.2" ry="2.4" width="4" x="10" y="20" />};
#diag $xml;
};
subtest circle => sub {
plan tests => 1;
my $svg = SVG->new;
my $tag = $svg->circle(
cx => 100,
cy => 100,
r => 50,
id => 'circle_in_group_y'
);
my $xml = $svg->xmlify;
like $xml, qr{<circle cx="100" cy="100" id="circle_in_group_y" r="50" />};
#diag $xml;
};
subtest ellipse => sub {
plan tests => 1;
my $svg = SVG->new;
my $tag = $svg->ellipse(
cx => 10,
cy => 10,
rx => 5,
ry => 7,
id => 'ellipse',
style => {
'stroke' => 'red',
'fill' => 'green',
'stroke-width' => '4',
'stroke-opacity' => '0.5',
'fill-opacity' => '0.2',
}
);
my $xml = $svg->xmlify;
like $xml,
qr{<ellipse cx="10" cy="10" id="ellipse" rx="5" ry="7" style="fill: green; fill-opacity: 0.2; stroke: red; stroke-opacity: 0.5; stroke-width: 4" />};
#diag $xml;
};
|