Added unit testing to prevent regression about disconnected infill paths
This commit is contained in:
parent
65b11fa850
commit
af1b64a086
2 changed files with 30 additions and 5 deletions
|
@ -144,6 +144,7 @@ sub rotate {
|
|||
my $self = shift;
|
||||
my ($angle, $center) = @_;
|
||||
@$self = Slic3r::Geometry::rotate_points($angle, $center, @$self);
|
||||
bless $_, 'Slic3r::Point' for @$self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
@ -151,6 +152,7 @@ sub translate {
|
|||
my $self = shift;
|
||||
my ($x, $y) = @_;
|
||||
@$self = Slic3r::Geometry::move_points([$x, $y], @$self);
|
||||
bless $_, 'Slic3r::Point' for @$self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
33
t/fill.t
33
t/fill.t
|
@ -2,7 +2,7 @@ use Test::More;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
plan tests => 2;
|
||||
plan tests => 4;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
|
@ -10,13 +10,16 @@ BEGIN {
|
|||
}
|
||||
|
||||
use Slic3r;
|
||||
use Slic3r::Geometry qw(scale X Y);
|
||||
use Slic3r::Surface qw(:types);
|
||||
|
||||
my $print = Slic3r::Print->new(
|
||||
x_length => 50,
|
||||
y_length => 50,
|
||||
);
|
||||
sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
|
||||
|
||||
{
|
||||
my $print = Slic3r::Print->new(
|
||||
x_length => 50,
|
||||
y_length => 50,
|
||||
);
|
||||
my $filler = Slic3r::Fill::Rectilinear->new(print => $print);
|
||||
my $surface_width = 250;
|
||||
my $distance = $filler->adjust_solid_spacing(
|
||||
|
@ -27,4 +30,24 @@ my $print = Slic3r::Print->new(
|
|||
is $surface_width % $distance, 0, 'adjusted solid distance';
|
||||
}
|
||||
|
||||
{
|
||||
my $print = Slic3r::Print->new(
|
||||
x_length => scale 100,
|
||||
y_length => scale 100,
|
||||
);
|
||||
my $filler = Slic3r::Fill::Rectilinear->new(
|
||||
print => $print,
|
||||
max_print_dimension => scale 100,
|
||||
);
|
||||
my $surface = Slic3r::Surface->new(
|
||||
surface_type => S_TYPE_TOP,
|
||||
expolygon => Slic3r::ExPolygon->new([ scale_points [0,0], [50,0], [50,50], [0,50] ]),
|
||||
);
|
||||
foreach my $angle (0, 45) {
|
||||
$surface->expolygon->rotate($angle, [0,0]);
|
||||
my ($params, @paths) = $filler->fill_surface($surface, flow_spacing => 0.69, density => 0.4);
|
||||
is scalar @paths, 1, 'one continuous path';
|
||||
}
|
||||
}
|
||||
|
||||
__END__
|
||||
|
|
Loading…
Reference in a new issue