Return Surface->expolygon by reference

This commit is contained in:
Alessandro Ranellucci 2013-08-31 00:28:24 +02:00
parent 828785312e
commit bb45437526
3 changed files with 14 additions and 3 deletions

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 12;
use Test::More tests => 13;
my $square = [ # ccw
[100, 100],
@ -27,7 +27,7 @@ my $surface = Slic3r::Surface->new(
$surface = $surface->clone;
isa_ok $surface->expolygon, 'Slic3r::ExPolygon', 'expolygon';
isa_ok $surface->expolygon, 'Slic3r::ExPolygon::Ref', 'expolygon';
is_deeply [ @{$surface->expolygon->pp} ], [$square, $hole_in_square], 'expolygon roundtrip';
is scalar(@{$surface->polygons}), 2, 'polygons roundtrip';
@ -41,6 +41,12 @@ is $surface->bridge_angle, 30, 'bridge_angle';
$surface->extra_perimeters(2);
is $surface->extra_perimeters, 2, 'extra_perimeters';
{
my $surface2 = $surface->clone;
$surface2->expolygon->scale(2);
isnt $surface2->expolygon->area, $expolygon->area, 'expolygon is returned by reference';
}
{
my $collection = Slic3r::Surface::Collection->new($surface, $surface->clone);
is scalar(@$collection), 2, 'collection has the right number of items';