Implement ExPolygon::XS->clone()
This commit is contained in:
parent
8d49c4063b
commit
9dc1a3c69d
@ -15,4 +15,6 @@ package Slic3r::ExPolygon::XS;
|
||||
use overload
|
||||
'@{}' => sub { $_[0]->arrayref };
|
||||
|
||||
sub clone { (ref $_[0])->_clone($_[0]) }
|
||||
|
||||
1;
|
||||
|
@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 5;
|
||||
|
||||
my $square = [ # ccw
|
||||
[100, 100],
|
||||
@ -26,4 +26,8 @@ isa_ok $expolygon->arrayref, 'Slic3r::ExPolygon', 'Perl expolygon is blessed';
|
||||
isa_ok $expolygon->[0], 'Slic3r::Polygon', 'Perl polygons are blessed';
|
||||
isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
|
||||
|
||||
my $clone = $expolygon->clone;
|
||||
is_deeply [ @$clone ], [$square, $hole_in_square], 'clone';
|
||||
# TODO: check that modifying the clone doesn't modify the original one
|
||||
|
||||
__END__
|
||||
|
Loading…
Reference in New Issue
Block a user