Polygon->lines

This commit is contained in:
Alessandro Ranellucci 2013-07-15 23:28:23 +02:00
parent 77c479c127
commit 62e5bd0ee7
3 changed files with 25 additions and 2 deletions

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 3;
use Test::More tests => 4;
my $square = [ # ccw
[100, 100],
@ -19,4 +19,12 @@ is_deeply $polygon->pp, $square, 'polygon roundtrip';
is ref($polygon->arrayref), 'ARRAY', 'polygon arrayref is unblessed';
isa_ok $polygon->[0], 'Slic3r::Point', 'polygon point is blessed';
my $lines = $polygon->lines;
is_deeply [ map $_->pp, @$lines ], [
[ [100, 100], [200, 100] ],
[ [200, 100], [200, 200] ],
[ [200, 200], [100, 200] ],
[ [100, 200], [100, 100] ],
], 'polygon lines';
__END__