Update brim generation code. Includes regression test. #1440

This commit is contained in:
Alessandro Ranellucci 2013-09-16 10:33:30 +02:00
parent 5a9c163a2e
commit aef5c05c57
4 changed files with 38 additions and 19 deletions

View file

@ -1,4 +1,4 @@
use Test::More tests => 1;
use Test::More tests => 2;
use strict;
use warnings;
@ -43,4 +43,29 @@ use Slic3r::Test;
ok $test->(), "skirt_height is honored when printing multiple objects too";
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('skirts', 0);
$config->set('perimeters', 0);
$config->set('top_solid_layers', 0); # to prevent solid shells and their speeds
$config->set('bottom_solid_layers', 0); # to prevent solid shells and their speeds
$config->set('brim_width', 5);
$config->set('cooling', 0); # to prevent speeds to be altered
$config->set('first_layer_speed', '100%'); # to prevent speeds to be altered
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my %layers_with_brim = (); # Z => $count
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if (defined $self->Z) {
$layers_with_brim{$self->Z} //= 0;
$layers_with_brim{$self->Z} = 1
if $info->{extruding} && $info->{dist_XY} > 0 && ($args->{F} // $self->F) != $config->infill_speed*60;
}
});
is scalar(grep $_, values %layers_with_brim), 1, "brim is generated";
}
__END__