Test coverage for retract_layer_change

This commit is contained in:
Alessandro Ranellucci 2014-04-19 19:28:43 +02:00
parent 7041ebdd22
commit c4bfe64fb8

View File

@ -1,4 +1,4 @@
use Test::More tests => 16;
use Test::More tests => 17;
use strict;
use warnings;
@ -10,6 +10,7 @@ BEGIN {
use Slic3r;
use Slic3r::Test qw(_eq);
{
my $config = Slic3r::Config->new_from_defaults;
my $duplicate = 1;
@ -128,5 +129,30 @@ $config->set('infill_extruder', 2);
$config->set('skirts', 4);
$config->set('skirt_height', 3);
$retract_tests->(' (dual extruder with multiple skirt layers)');
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('retract_layer_change', [0]);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my $retracted = 0;
my $layer_changes_with_retraction = 0;
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($info->{retracting}) {
$retracted = 1;
} elsif ($info->{extruding} && $retracted) {
$retracted = 0;
}
if ($info->{dist_Z} && $retracted) {
$layer_changes_with_retraction++;
}
});
is $layer_changes_with_retraction, 0, 'no retraction on layer change';
}
__END__